curses standout()
Brandon S. Allbery KB8JRR
allbery at NCoast.ORG
Wed Jul 4 10:57:30 AEST 1990
As quoted from <3610 at zorba.Tynan.COM> by raza at cs.heriot-watt.ac.uk:
+---------------
| the problem is that when i try and use the curses function standout(), it
| simply doesn't work! (this function is used with standend() to make text
| appear in reverse video).
| i am using a TELEVIDEO model 910+, 920c and 910g type terminal, the problem
| is that the function DOES work with a vt100 type terminal.
+---------------
The Televideo 910/920 series terminal is possessed of an affliction known as
"attribute spaces", sometimes called "magic cookies". This means that the
start-reverse-video and end-reverse-video sequences take up space on the
terminal display. Moreover, the sequences are not applied to individual
characters; they're applied to the space on the screen between the standout()
and standend() sequences. Some terminals enforce an automatic end-reverse-
video at the end of a physical line as well. Curses was written for ANSI
X3.64 terminals, however; it assumes that attributes are stored as "extra
bits" in a character instead of in "invisible" character positions, and apply
to any characters output between the start-reverse-video and end-reverse-video
sequences regardless of screen position.
This can cause curses to fail in either of two ways:
(1) It can output the start-reverse-video sequence somewhere where it won't
affect the text you want to show reversed; that is, after the text (with
respect to the physical position on the terminal screen) or on a different
line (of the terminal forces end-reverse-video at end of line);
(2) It can output the start-reverse-video sequence, then write over it with
your message; since the terminal considers the attribute space to be like
any other character, if something else is printed over it, it is replaced
by the character. As a result, the string comes out in normal video.
System V curses attempts to handle this "correctly"; it requires that the
terminfo entry spacify both "xmc#1" to indicate that attributes take up space
on the screen and "!msgr" to specify that attributes apply to screen positions
and not characters. And it doesn't always get it right.
Alternatives:
(1) Use ANSI X3.64 compatible terminals like the VT100 or the Televideo 970.
(Sometimes known as "Get a *real* terminal!" by snobs.)
(2) Many terminals of the Televideo persuasion support "protected" characters;
often, the attribute used to indicate that a character is "protected" can
be configured at terminal set-up or sometimes from software. Moreover,
the "protect" attribute can be set without actually activating write-
protect mode. (The usual escape sequences are <ESC>) to begin protect
mode and <ESC>( to end it.) If you can set the "protect attribute" to
reversed and change the termcap/terminfo to use the start/end protect mode
escape sequences, reverse video will work from curses: protect mode acts
like ANSI X3.64 attributes, not like "attribute spaces". (This is espec-
ially useful on Wyse Technologies' terminals that lack ANSI compatibility;
and the WY-75 actually uses this trick internally to make <ESC>[?m (where
"?" is any number except 0) do ANSI-compliant reverse video.)
++Brandon
--
Me: Brandon S. Allbery VHF: KB8JRR on 224.50 (Lake County, OH)
Internet: allbery at NCoast.ORG Delphi: ALLBERY
uunet!cwjcc.cwru.edu!ncoast!allbery America OnLine: BrandonA or KB8JRR
More information about the Comp.unix
mailing list