128 points · by begoon · 1y ago · 52 comments
Then I found Textual (Python library, https://textual.textualize.io/) which feels like its modern and prettier child. Not gonna lie, it's still not a turnkey solution that transformed my clumsy scripts into a beautiful TUI without work but it's close!
Can you elaborate on that? Are your "clumsy scripts" written in Python, shell or another language? Have you tried Textual-based tools like Trogon [1] and Moulti? [2]
[1] https://github.com/Textualize/trogon [2] https://moulti.run/
Thanks a lot for sharing these, especially Trogon, which I think is a clever idea with high ROI.
Tunneling through the layer of crust accumulated in order to support Unicode (several layers of crust as Unicode evolved) was probably the most interesting of all.
They probably went to efforts to make it work an ancient system. But you really didn't have to.
That being said, if you're doing something less involved, controlling the terminal via ansi escape sequences is not rocket surgery.
https://en.wikipedia.org/wiki/ANSI_escape_code
https://github.com/codr7/sharpl/blob/main/src/Sharpl/Term.cs
This sets the document at a particular point in time … in a lot of ways a better point in time.
I really miss the mid-90s computer scene. Things worked, often well, and in comparison to today they were so low-latency!
Not all of them are good, but there are way better chances that I like it than the 'other one' (3D game / GUI).
I think the reasons are similar. When you don't have to focus so hard on what it should look like you spend more time on whether it is a pleasure to use.
Ages ago on a mini I use to program, there was a very simple library I could call to format a screen. You told it modifiable field type and its text plus position on the screen. The screen was fixed at 80x24 plus no popups.
I wish there was a simple wrapper for curses like that :)
In the DOS Days, zortech c had a nice set of functions for screen input, disp_*, those were easy for my simple mind to understand to.
What I would like is a (n)curses library that uses a graphics back end instead of a TTY, preferably written in Go. I want a GTUI (Graphical-Text User Interface 8-)
Side note, Anyone know a site that curates a list of TUI designs? And not just good ones but examples of bad and weird.
(there's usually delay between Esc taking action, one should press it once and then wait a second until it takes effect)
Bytes arrive serially, one at a time, one after another.
There is no predictable garanteed time between bytes. Any two bytes in the stream may arrive with any amount of time between them, 1 ns, 1s, 1 hour, 1 week...
So anything that reads the bytes must have some sort of timeout whereby on seeing an esc, it waits up to some time for the rest of the escape sequence before giving up and treating the esc as a lone byte or a byte that was not lone but not not part of an escape sequence either. IE, no recognized termcap code ending with ";" etc. During that time it may be either waiting while no bytes are coming in, or it may be collecting bytes that haven't yet added up to some known terminal control code.
Normally even a very long valid escape sequence would all come in a fraction of a second, and so you'd think a tiny timeout like 0.1 second would be fine, but there are such things as far slower baud rates, and even if your immediate terminal has an infinite baud rate, some link in the unknown chain to your terminal could be any other speed, and there can be unpredictable pauses in otherwise fast baud rates. Even on the modern internet the timeout needs to account for some router hiccough anywhere in the 1000 miles between the source & your terminal.
Most apps that want to use esc as a direct "normal" key need to either use raw mode if that's even an option, or make the user type "esc-esc" instead of just "esc", and because of that, they just shouldn;t even be trying to do that in the first place, they should know better. It's not a good key to use for "abort" or anything else unless your environment is windows or dos.
It seems to have a fair bit of support.