Yarn

Recent twts in reply to #ex5vwtq

On my way to having windows and mouse support:

https://movq.de/v/95bbbbd3e8/basic-windows.mp4

It would be cool to have something like Turbo Vision eventually.

(I considered just using Turbo Vision, but it’s a C++ library and that’s not quite what I’m looking for. But it’s not yet completely off the table.)


#ex5vwtq

(#ex5vwtq) At around 19 seconds in the video, you can see some minor graphical glitches.

Text mode applications in Unix terminals are such a mess. It’s a miracle that this works at all.

In the old DOS days, you could get text (and colors) on the screen just by writing to memory, because the VGA memory was mapped to a fixed address. We don’t have that model anymore. To write a character to a certain position, you have to send an escape sequence to move the cursor to that position, then more escape sequences to set the color/attributes, then more escape sequences to get the cursor to where you actually want it. And then of course UTF-8 on top, i.e. you have no idea what the terminal will actually do when you send it a “🙂”.

Mouse events work by the terminal sending escape sequences to you (https://www.xfree86.org/current/ctlseqs.html#Mouse%20Tracking).

ncurses does an amazing job here. It’s fast (by having off-screen buffers and tracking changes, so it rarely has to actually send full screen updates to the terminal) and reliable and works across terminals. Without the terminfo database that keeps track of which terminal supports/requires which escape sequences, we’d be lost.

But gosh, what a mess this is under the hood … Makes you really miss memory mapped VGA and mouse drivers.


#eyfftcq
Login to participate in this yarn.