Hi @RaphGL!
Thanks for your comments, really appreciate you made this library.
No support for handling terminal resizes (need to catch some signal). It’s not hard to implement but I guess it’s needed for most terminal apps.
You don’t need this, I already retrieve the size before every draw. You’ll likely be running on a loop so you can easily compare previous and current sizes of the terminal to handle resizes.
In my case, I do not use a mainloop that continuously render frames, rather I wait blocking on events and redraw if there is some user input. I do not see why I would continuously render when stuff can only change based on user input.
Then I need to know when the terminal resized so I can trigger a re-render. I implemented a signal in 10 lines to do this, but it could be provided as a native event for even more convenience.
It gets actually a little more complex than that, because there might be some internal events (e.g. a watched file changes) which also trigger, but I don’t continuously re-render frames, rather poll events and re-render when needed.
I didn’t have this use cases while using/testing the library so it just slipped, but most of my use for something like this was using read_raw and then calling the parse_mouse_input and parse_keyboard_input myself instead.
I am doing this, but I actually need to go from termcl.Key to the character it corresponds to (if any). Like termcl.A would become a. Sounds like a matter of reimplementing the big switch in the reverse direction.
Unsure why ncurses is so large, but I guess it’s way more battle tested for all edge cases…
Ncurses is old and wants to support every terminal under the sun, it queries a database for capabilities and escape code support and tries to have all these weird terminals behaving the same. TermCL completely rejects old terminals and only supports ANSI escape codes. I went out of my way to only test on terminals people actually use on windows, linux and macos. I don’t really see a reason to support old standards when 90% of people will never interact with them anymore and it makes the library way way simpler
I am actually totally fine for this. I do not care about supporting 80s terminal emulators
. One issue I have had however, is that I can’t get it to run in the intellij command run window, even with emulate terminal set to true. Something causes a SIGILL. But that’s just a matter of convenience for me.
The SDL3 backend is there so that you can run a TUI without having a terminal. It was originally because I wanted to have a GUI and a TUI for my editor the same way emacs does. Also the backend API allows you to add support for weird platforms ncurses supports and I don’t.
That’s actually a neat feature (haven’t tried hard enough to make it work). However, I think if I use termcl what I want is simply a text-based lib in 99% of cases. There might be some space for a text-based lib but rendered graphically, just as a way to make text-heavy GUI apps in a very simple manner, but maybe belong to another project.
The source code is very nice and easy to read, so it was not a problem to use the library, however a bit longer page of docs showcasing a couple features would help to quickstart.
Also, I do not mind writing my own widgets, however I think a scroll primitive (like a window that can scroll and maybe would make application code a lot simpler in most cases.
Another one could be a text input widget supporting proper text movement (e.g. home/end, ctrl+arrow, ctrl+delete or backspace), but on that one I am less sure as it would need to handle events somehow, and it gets complicated.
Currently, I am a bit time-starved but maybe in the future if I have some time I might check these issues more in depth.