[Toybox] [Aboriginal] notcurses
Rob Landley
rob at landley.net
Fri May 15 15:24:03 PDT 2015
On 05/15/2015 01:40 PM, Kartik Agaram wrote:
> Rob, I just had your post from the 27th pop up on my RSS reader:
> http://www.landley.net/notes-2015.html#27-04-2015
Technically this is a toybox question. :)
> Are you aware of https://github.com/nsf/termbox? A few weeks ago I
> replaced ncurses with it in my project
> (http://github.com/akkartik/mu#readme), and the version I've inlined
> there is even smaller and even more self-contained (no waf-fling).
I've looked at a few, but basically the hard part is the keyboard
scanning function:
https://github.com/landley/toybox/blob/master/lib/interestingtimes.c#L89
Which still isn't actually that hard, especially since I had to rewrite
busybox's implementation way back when because they did it wrong, ala
these two commits:
http://git.busybox.net/busybox/commit/?id=988dd5549bc7
http://git.busybox.net/busybox/commit/?id=5e38cd910aca
Already had rather extensive learning experiences here, so I might as
well just implement the result. Once you understand it, it's _really_
not that hard, the sequences are documented and everything:
http://man7.org/linux/man-pages/man4/console_codes.4.html
(There's also xterm's
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html and the ANSI
x3.64 standard http://sydney.edu.au/engineering/it/~tapted/ansi.html and
so on, but the console_codes is mostly a common subset.)
Also, back in that bulletin board system I mentioned (written back in
1990), I implemented my own ansi handler that maintained a screen write
buffer so I could essentially do virtual terminals in dos. Mine could
show you ~3 lines of each (cursor and two lines above it, unless that
goes above top of screen in which case top 3 lines). Meaning I got very
familiar with the dos version ansi escape sequences at one point because
I wrote my own driver for it, and my limiting factor is it's been so
long I don't necessarily remember the details and have to look them up
again.
Rob
1431728643.0
More information about the Toybox
mailing list