Magic cookie glitch problems with curses

Clifford Heath cjh at hpausla.aso.hp.com
Thu May 31 12:16:18 AEST 1990


> My problem is that I *have* to use at least one attribute with my software.

The bottom line with magic cookie terminals is that they have 8 bits
of memory per character; 7 bits is used for ASCII, one bit may be used
to indicate a single attribute (often half bright) on each character.
Other attributes are indicated by storing a non-displayable character
(0-31 decimal) in a character cell, and using that to set the display
attributes for following characters (either to end of line or end of page).

So, if you only want one attribute, it takes no space; don't tell curses
that you have a magic cookie terminal.  If you want more attributes,
it takes a space each time you change.

Curses doesn't handle cookie terminals very well.  Whenever it finds that
it needs to change attribute, it *inserts* a space to place the attribute
in and hence shuffles the rest of the line along, losing the last char.
This can be handled better by looking at the character preceding the
attribute change; it is often a space, since space is usually left
between a label and an entry field, for example.  This space can
be used for storing the attribute.  The only constraint on screen
design is that there should always be a space before an attribute
change (including at end of line if the terminal propagates attributes
over lines) and at start of line (if not).

I've implemented this solution very effectively in some *proprietry*
software for HP so I know it works.  Please don't ask how you can
buy it for Xenix; at present it only comes as part of HP ALLBASE/4GL
and related products.

Clifford Heath, Hewlett-Packard Australian Software Operation.
cjh at hpauslw.HP.COM, hplabs!hpauslw!cjh.



More information about the Comp.unix.xenix mailing list