SUMMARY: CURSES: magic cookie glitch chars
Robert Felps
felps at convex.com
Fri Nov 16 23:30:40 AEST 1990
The question posted was,
Can anyone shed some light on 'magic cookie glitch characters'?
And the answers are ...
Nick Sayer writes,
It is my understanding that "magic cookie" terminals, like the
TVI-925, are such because the characters that start and end the
standout mode(s) actually take space on the CRT. That is, they
are like special versions of the space character. If you over-print
them, their special meaning disappears, thus the standout is turned off
for the data immediately following. This causes all sorts of hell,
but that's the way it is.
Bob Weissman writes,
I haven't read this book, but I do know that certain extremely
brain-damaged terminals such as the TeleVideo 900 series have this
problem.
Changing character attributes on the screen takes up a character
location. E.g., if you want to underline only part of a word,
as in
underline
----
you find you can't do it because changing the attributes causes
an extra character space to get used and you end up with
un derl ine
----
instead, or maybe
un derl ine
-----
So some modern termcap/curses combinations have special ways of
getting around this. Sun's termcap, for example, has a "ug" capability,
which is described as
ug num number of garbage chars left by us or ue (default 0)
so that you can at least do whole-word underlining without extra spaces
appearing.
Andy Behrens writes,
Some terminals highlight characters by storing the highlighting mode
(inverse video, dim, blinking, etc.) of each position on the screen.
For these terminals, you set the mode and then write the characters to
the screen.
Other terminals (mostly older ones) store mode information on the
screen -- it takes up a character position. The "character" occupying
this position is called a magic cookie; I don't know why. The mode
change affects all the characters on the screen until the next magic
cookie. The advantages of this system are that you can highlight a
block of text without having to redraw it -- just rewrite the magic
cookies at the start and end. Also, you only need 7 or 8 bits for each
character, instead of 12 (8 databits + 4 mode bits for 4 different
types of highlighting). That seems like a small difference now, but
back when memory was expensive, it was a significant savings. On the
down side, you have to use up a character position on the screen every
time you change modes.
The VT100, "ansi" terminals, and most other modern terminals, store
mode information with each character. The widely emulated Televideo
925 is an example of the "magic cookie" type of terminal.
Phong Vo writes,
Actually, the right characterization is that a magic cookie is a mark
on the screen which alters the current attributes. There are two major
families of terminals, HP26xx and Televideo, that have this
(mis)feature. For the HPs, the marks have zero width (i.e., it does
not take up one space on the screen) while for the TVIs, the mark is
1-char width. These cookie critters make life interesting for software
like curses. The curses that I wrote, SysVr3.1 or later, handles the
HPs correctly and does the best it can for the TVIs.
Thanks to all of you for the explanations.
Robert Felps felps at convex.com
Convex Computer Corp OS System Specialist
3000 Waterview Parkway Tech. Assistant Ctr
Richardson, Tx. 75083 1(800) 952-0379
More information about the Comp.unix.programmer
mailing list