word processor history -- interesting article (Evan Koblentz)
mouse at Rodents-Montreal.ORG
Fri Jul 8 17:44:47 CDT 2016
> I've come to the conclusion  that terminfo and curses aren't
> needed any more. If you target VT100 (or Xterm or any other
> derivative) and directly write ANSI sequences, it'll just work.
(a) That is not my experience.
(b) To the extent that it's true, it works only if you stick to a very
much least-common-denominator set of sequences. VT-100s, VT-220s,
VT-240s, xterms, kterms, etc, each support a slightly different set of
sequences, with in some cases (eg, DCS) slightly different semantics
for the same basic sequences. Assume anything more than some very
minimal set and you are likely to find it breaks somewhere.
> It's a few lines of code to get the current TTY (on any modern Unix
> system) into raw mode in order to read characters .
"Raw mode" has been ill-defined since sgtty.h gave way to termios.h.
Raw mode usually means something like -icanon -isig -echo -opost, and
for lots of purposes you don't need to go that far; -icanon with min=1
time=0 is enough for anything that doesn't want to read
usually-signal-generating characters as data.
>  It's six lines to get an open TTY into raw mode,
struct termios o, n; tcgetattr(fd,&o); n=o; cfmakeraw(&n); tcsetattr(fd,TCSANOW,&n);
One line, though admittedly it's a little long. Two if you want to
keep the declarations and code separate.
> one line to restore upon exit. Add in a few more lines to handle
> SIGWINCH (window resize). *Much* easier than dealing with curses.
Depends on what you're doing. For lots of purposes, if you don't use
curses or something morally equivalent, you will have to reinvent it,
which carries its own prices.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
More information about the cctalk