Show HN: A retro terminal text editor for GNU/Linux coded in C (C-edit) (github.com)
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
63 comments
[ 2.9 ms ] story [ 80.5 ms ] threadTurbo Vision: https://github.com/magiblot/tvision
[0] https://www.youtube.com/watch?v=s_01Xhd2EJM
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)
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
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/zyedidia/micro
There's a QBjs, for QuickBasic on the web.
There's a QB64 vscode extension: 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.
GORILLA.BAS! https://en.wikipedia.org/wiki/Gorillas_(video_game)
gorilla.bas with dosbox in html: https://archive.org/details/GorillasQbasic
rewritten with jquery: 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
- sensorcraft is like minecraft but in python with pyglet for OpenGL 3D; self.add_block(), gravity, ai, circuits: https://sensorcraft.readthedocs.io/en/stable/
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.
What about those who use VT-52 terminals?
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);
- 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).
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).
https://ports.macports.org/port/libgrapheme/
The only sensible normalisation one can implement is the full decomposition (NFD), and maybe the full composition (NFC). You rely on the full decomposition if you want to collate correctly, which is a problem because the amount of memory needed to store the decomposition is unbounded in general. I don't want to make the libgrapheme users jump through hoops, and I also don't want to do any memory allocations in libgrapheme either.
There is an idea floating in my head on how to solve this, but I'm currently busy finalising Unicode 15.1 support (Unicode 16.0, released on the 10th, will be trivial to upgrade to) and releasing my already fully-compliant implementation of the Unicode bidirectional algorithm.
LLVM has been using rope data structures for some time. There is more discussion about it here:
https://lists.llvm.org/pipermail/llvm-dev/2011-July/041639.h...
In my situation when parsing lines of code Twine stores the file path and concats the line number and column when getting the location within a file. It does this a lot so using Twine there really helps. The rope data structure can be used in a number of ways.
https://winworldpc.com/product/qedit/30
Looks like the author of that released the larger editor (semware editor) for free https://www.semware.com/ some time ago. That was always the more expensive editor the kid version of me couldn't afford.
1. <https://www.finseth.com/craft/>
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>
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.m...