6 ms·
Show HN: A retro terminal text editor for GNU/Linux coded in C (C-edit)
I set about coding my own version of the classic MS-DOS EDIT.COM for GNU/Linux systems four years ago and it this is where the project is at... still rough around the edges but works well with Termux! :)
Demo:
https://www.youtube.com/watch?v=H7bneUX_kVA https://www.youtube.com/watch?v=H7bneUX_kVA
- Turboblack 2y agoIt would be nice to have one like this (full screen) for Windows
- velorek 2y agoYes, I would like to make a cross-platform editor one day. I would probably choose Pascal's RTL video unit over C for that task. There is one editor called YEDIT that fits the brief for windows systems: http://www.malsmith.net/edit/ http://www.malsmith.net/edit/
- miohtama 2y agoFYI The classical Borland text user inteface (TUI) framework used in Turbo Pascal and other terminal MS-DOS editors is open source. Turbo Vision: https://github.com/magiblot/tvision https://github.com/magiblot/tvision
- deleted 2y ago[deleted]
- dbrueck 2y agoThe sense of nostalgia this evokes is so strong, thank you for sharing this!
- velorek 2y agoIt's awesome. Free Pascal IDE is based on this I think. It certainly something to aspire to :) thanks for sharing
- badsectoracula 2y agoIt isn't, Free Vision (Free Pascal's own Turbo Vision library) has a much more weird history though it is indirectly based on the C++ code Borland released back in the 90s, like the version linked here (see my other comment). They have a common ancestor but they are different "branches".
- velorek 2y agoI see, thanks for the clarification. Btw, I really enjoyed YT "Making a game in Free Pascal" back in the day. I did learn a lot from your video :) Pascal is one of my top languages to code in! Nice to see you around here
- badsectoracula 2y agoYou just made me realize it has been 10 years since that video :-P. It has been a while since i made a similar video (last one was 'Making a game in Linux using Lazarus' from 6 years ago, most of my more recent videos are random clips from random stuff i work on). Perhaps i'll try making a new one at some point. [0] https://www.youtube.com/watch?v=s_01Xhd2EJM https://www.youtube.com/watch?v=s_01Xhd2EJM
- fsckboy 2y agothat's cool! so this is the turbo-* vision part, but the *-pascal part is not included? is there one of those anybody knows about? I have the source to a turbo pascal BRIDGE.PAS card game player I used to enjoy playing. (it's not a good bridge player and it has a scoring bug, but I know how to fix it, and I can run it in dosbox if I want so I'm not desperate in that sense, but I'd rather run native)
- badsectoracula 2y agoFree Pascal comes with Free Vision. FV has some weird history in that Borland released their C++ conversion of Turbo Vision to public domain, then someone converted that to Turbo Pascal and converted it to use graphics instead of textmode (with coordinates in pixels, etc) and then it was ported to Free Pascal and converted back to text mode and to use Free Pascal's cross platform text mode units. The Free Pascal IDE that comes with the compiler is made using Free Vision and Free Vision works on pretty much any platform Free Pascal itself supports (as long as it has some form of text mode). Regardless of the history, the API is basically the same, you can even read a tutorial written for Turbo Vision and apply it to Free Pascal with minimal changes. Recently there has been a UTF-8 version (original TP -and FV- was made for 8bit DOS character codes) though it is a big buggy and slower than the non-UTF-8 version. I tried to use to make an Info viewer[0] some months ago but i had to switch to the non-UTF-8 version due to the bugs. [0] https://i.imgur.com/Qvkt3W0.png https://i.imgur.com/Qvkt3W0.png
- Brian_K_White 2y agoGoing sort of the other way, making an X version of a Borland-like ui, a long time ago I liked XWPE for a while. Even built it for SCO.
- velorek 2y agoIt seems like an interesting project as well! I'd love to see it one day
- Brian_K_White 2y agoI didn't realize there weren't any screenshots anywhere. I'll make a few, assuming it still even builds. I haven't used it since '99. It was neat but really not exactly a productivity tool today!
- deleted 2y ago[deleted]
- vunderba 2y agoLove the look, definitely throwing me back to the halcyon QBasic days. Slightly related but another way to simulate a retro text editor (old school raster style green screen aesthetic in this instance) is to combine the "cool-retro-term" terminal with the minimal editor "micro". https://github.com/Swordfish90/cool-retro-term https://github.com/Swordfish90/cool-retro-term https://github.com/zyedidia/micro https://github.com/zyedidia/micro
- MadnessASAP 2y agoI love cool-retro-term, I keep it running with a Matrix style terminal toy as a "screensaver" on the small PC sitting on my homelab. It's an ostentatious waste of power and CPU cycles but I appreciate the aesthetics of it.
- devbent 2y agoI'd kill for a way to apply CRT's filters to my vscode editor...
- westurner 2y agoQB64 is an EDIT.COM-style IDE and a compiler for QuickBasic .BAS programs: https://github.com/QB64Official/qb64#usage https://github.com/QB64Official/qb64#usage There's a QBjs, for QuickBasic on the web. There's a QB64 vscode extension: https://github.com/QB64Official/vscode https://github.com/QB64Official/vscode Textual has a MarkdownViewer TUI control with syntax highlighting and a file tree in a side panel like NERDtree, but not yet a markdown editor.
- velorek 2y agoInteresting project. Thanks for sharing! :)
- Cheer2171 2y agoQuickBasic was my first programming language and EDIT.COM was my first IDE. I love going back down memory lane, thanks!
- westurner 2y agoSame. `edit` to edit. These days perhaps not coincidentally I have a script called `e` for edit that opens vim: https://github.com/westurner/dotfiles/blob/develop/scripts/e https://github.com/westurner/dotfiles/blob/develop/scripts/e GORILLA.BAS! https://en.wikipedia.org/wiki/Gorillas_(video_game) https://en.wikipedia.org/wiki/Gorillas_(video_game) gorilla.bas with dosbox in html: https://archive.org/details/GorillasQbasic https://archive.org/details/GorillasQbasic rewritten with jquery: https://github.com/theraccoonbear/BrowserGORILLAS.BAS/blob/master/js/gorillas.js https://github.com/theraccoonbear/BrowserGORILLAS.BAS/blob/m... Basically the same thing but for learning, except you can't change the constants in the simulator by editing the source of the game with Ctrl-C and running it with F5: - PHET > Projectile Data Lab https://phet.colorado.edu/en/simulations/projectile-data-lab https://phet.colorado.edu/en/simulations/projectile-data-lab - sensorcraft is like minecraft but in python with pyglet for OpenGL 3D; self.add_block(), gravity, ai, circuits: https://sensorcraft.readthedocs.io/en/stable/ https://sensorcraft.readthedocs.io/en/stable/
- nunobrito 2y agoWhen you mentioned retro I was expecting something like editline. Now I feel old. Anyways, the TUI on mainstream MS-DOS 6.22 and Borland from those days were incomparable to anything on mainstream Linux even on these days. For some reason Linux is the king of text mode and yet never had a proper TUI tradition. Thank you for sharing the project. Compiled well on my side, looking forward to the next developments. My (unrequested) feedback: + consider renaming from C-edit (uppercase) to lower case c-edit, because it is simpler to type from the terminal. + the animations of the spining part on top was distracting + some menus missing to implement functionality, didn't test copy&paste + mouse support would be nice, albeit optional but would complete the MS-DOS 6.22 / borland style since it supported mouse there too Thank you.
- velorek 2y agoGlad it compiled! Most of your suggestions are on my to-do list indeed. I wanted to maintain an animation to demonstrate that it could be kept running throughout all the different dialogs and listboxes. I'll probably end up changing it. Thank you for testing it. :)
- rbanffy 2y agoI have to say that when I saw retro I expected ncurses support. Not all retro terminals understand VT100 escape sequences ;-) What about those who use VT-52 terminals?
- hnlmorg 2y agoUnless you’re using an actual hardware VT52, then it’s pretty safe to assume VT100 support these days.
- rbanffy 2y agoI concede most physical terminals still alive will have some form of VT100 emulation (up to VT500-level, usually), but half the fun is to make something that can actually run on ancient hardware.
- two_handfuls 2y agoThis look brings back old memories! Great job!
- velorek 2y agoThank you, I appreciate it :)
- jll29 2y agoApart from the learning experience, there is still value in a small-sized, fast TUI text editor for Linux. However, my two suggestions would be: - add Unicode support (it's the 21st century, so ∑, ®, etc. should finally work); this is not easy, but the earlier you do it the less dramatic the changes will be (check out https://github.com/unicode-org/icu/tree/main/icu4c); https://github.com/unicode-org/icu/tree/main/icu4c); - don't allocate the lines individually (as you do now with malloc, having looked at the code); at least use an arena allocator, i.e. allocate larger chunks of memory and the provide your own alloc_line function that uses the larger chunks (called arenas) piecemeal. This will speed things up and reduce fragmentation. A more advanced approach would be not to use per-line buffers but to switch to rope data structures e.g. https://github.com/josephg/librope https://github.com/josephg/librope).
- badsectoracula 2y ago> This will speed things up and reduce fragmentation Does this really make much of a practical difference these last decades? I wrote a text editor back in the late 90s in DOS using DJGPP with per-line allocation and it worked fine on the Pentium MMX i had at the time (and my approach to optimization at that time was be ignorant of the concept :-P), i'm not sure it'd really make much of a difference on any desktop or laptop CPU released past 2000 - at least as far as users editing text files are concerned (might make a difference if you try to open a multiGB file with barely a line break and accidentally press a letter :-P).
- HexDecOctBin 2y agoNo, it won't. You might want an arena for other reasons (better reasoning about lifetimes, preventing nest of pointers, etc.), but an array of line array approach to text editors is totally valid (except in the case of millions of extremely small lines).
- lanstin 2y agoI do from time to time open files of millions of small lines. To this day vim handles it better than emacs. These would be log files.
- qskousen 2y agoLooks great! Makes me nostalgic for when I spent my days as a kid in QEdit. https://winworldpc.com/product/qedit/30 https://winworldpc.com/product/qedit/30
- rcleveng 2y agoOh wow, that's a name I've not heard in a long time. Looks like the author of that released the larger editor (semware editor) for free https://www.semware.com/ https://www.semware.com/ some time ago. That was always the more expensive editor the kid version of me couldn't afford.
- syngrog66 2y agovim
- velorek 2y agovim FTW! :D
- teddyh 2y agoThe Craft of Text Editing¹ should be required reading for everybody who wants to write a new text editor. 1. <https://www.finseth.com/craft/ https://www.finseth.com/craft/>
- velorek 2y agoI didn't know about this resource. Thank you for sharing. I had only seen this one https://viewsourcecode.org/snaptoken/kilo/ https://viewsourcecode.org/snaptoken/kilo/ I did notice that all editors modeled after this tutorial tended to be clones. That's why I opted for a trial-and-error approach as a learning experience.
- teddyh 2y agoSee also: EMACS: The Extensible, Customizable Display Editor <https://www.gnu.org/software/emacs/emacs-paper.html https://www.gnu.org/software/emacs/emacs-paper.html> from 1981, by Richard Stallman – the main author of Emacs – as a more Emacs-specific resource. Or Theory and practice of text editors, or, A cookbook for an Emacs, the original thesis written by Craig A. Finseth in 1980 before he wrote the book I originally linked to: <https://dspace.mit.edu/handle/1721.1/15905 https://dspace.mit.edu/handle/1721.1/15905>
- baudaux 2y agoI will try to compile it for https://exaequos.com https://exaequos.com !
- garganzol 2y agoDespite being developed in 2010s-2020s, the codebase gives those warm 1980s vibes. Microcomputers, endless possibilities, bright future ahead. What a departure from the modern world of doom.
- afc 2y agoVery cool! I've also been writing my own terminal text editor for a while (just crossed the ten years mark!), so I know how much dedication this takes. :-) One thing I did recently was start writing the lessons I've learned in my journey, I figured I'd share it in case it helps you, maybe you'll find one or two ideas interesting: https://github.com/alefore/weblog/blob/master/edge-lessons.md https://github.com/alefore/weblog/blob/master/edge-lessons.m...
- velorek 2y agoI wasn't able to compile edge for some reason but it looks cool :). I'll try to do it again when I have some free time. Thank you for sharing your insights. I totally understand what you say about the dedication part, especially when it comes to projects becoming bigger and bigger through the years. It's hard to keep focused and not get overwhelmed at some point
- baudaux 2y agoI have added cedit in exaequOS: https://exaequos.com/?a=/usr/bin/cedit https://exaequos.com/?a=/usr/bin/cedit ! It compiled successfully with no change. Still buggy, I need to investigate and fix
- velorek 2y agoCool! This other project of mine (1) is a more finished product and might be better for testing. It's a terminal periodic table with the same display principles as C-edit but should be less buggy. (1) https://github.com/velorek1/terminalperiodictable https://github.com/velorek1/terminalperiodictable
- makz 2y agoThis is awesome, for the past few months I’ve wondered why there was nothing like edit for Linux and now we have it, great.