As from version 3270v3.6 I have included code to deal with extended
character attributes. This is compiled in if the Makefile sets the symbol
EXTENDED (by -DEXTENDED in MFLAGS).

There are, however, a few things to watch. Some of these (the ones that
I remember) are as follows :-

Both extended colour and extended highlighting require control sequences
to operate. The highlighting ones (underline, blink and reverse video)
are standard, but not all termcap entries or terminals/emulators have
everything. The normal xterm, for instance, does not have blinking.
I do not (yet) tell the IBM exactly which ones are available, so that
the IBM may think it is sending blinking text, whereas the user is just
seeing normal text. Not much harm there.

The colour change sequences are NOT standard in termcap entries, nor
do they always work. On DEC VT series, including DECterm emulators, they
may work on colour screens, otherwise are ignored. There is a colour
version of xterm, called colxterm, which works, but the normal xterm
certainly does not. A third colour emulator, called mterm, has the colour
escape sequences but I cannot yet make it set the keypad mode correctly.
Note that these (col)xterm colour sequences are supposedly the ISO 6429
extension, which defines color0, color1, ... ,color7 as (by default)
black, red, green, yellow, blue, magenta, cyan, and white.

Specifically on DEC VT300 emulation (DECterm/dxterm) I make use of the
DEC special escape sequence for the "neutral" colour foreground and
background. This normally gives black on white or white on black according
as to what you have set as preference in the Display item of the Options
menu (Dark Text, Light Background or Light Text, Dark Background). Since
some colours look better on black, others on white, I tend to flip
between them. Of course, you can redefine the foreground and background
for the terminal emulation, and also the particular shades of the colours
used, in the standard manner for X: what happens then when you flip is
to be discovered!

For colxterm there is the slight problem that this "neutral" sequence
does not exist. I therefore have to make a specific choice as either
black or white (until that magic day when I can do the same nice option
as with the Brown University Macintosh tn3270 and make it a flippable
choice). For the moment I have put it in as black, which is OK unless you
are running colxterm with a black background! People who want a quick fix
should change the C7 colour sequence for ANSI terminals in telnet.c.
An alternative is to change the xterm resource "color7". A propos of this,
I noted that installing colxterm put the following onto the end of file
/usr/lib/X11/app-defaults/XTerm

*color0:    Black
*color1:      Red
*color2:    Green
*color3:   Yellow
*color4:     Blue
*color5:  Magenta
*color6:     Cyan
*color7:    White

so one could obviously do a bit more fancy playing to have "nicer"
shades of the various colours. I personally prefer LimeGreen on my
DECstation.

I guess that one could also invert color0 with color7 as another way
to deal with an xterm with a dark background: my choice would then
be inverted.

(Why did I choose black? Well, one popular X-terminal more or less obeys
 the colour sequences but, in some versions of the software, flips to a
 white background as soon as one chooses any foreground colour! On the same
 X-terminal it is disastrous to set the reverseVideo resource as true if
 the terminal is a colour one!)

The same X-terminal has another "feature": it is VT-200 compatible, which
means that it responds to terminal enquiry sequences as a VT200, which in
turn means that the value of the environment variable TERM is liable to be
something like VT200. However, it does not have the concept of "neutral"
colours, so to work in colour it has to be run as an xterm. For the
moment this means resetting TERM: at some future time I will allow a call
parameter to override the value of TERM (used to pick up the termcap
sequences) and/or the choice of colour method (I believe HP have yet other
methods of choosing colours!).

I don't know if DECterm/dxterm can have the same possibility: would be nice!

There are actually some other differences to handle, involving what happens
when we switch to reverse video, which explain why the DEC colour
sequences set both foreground and background but the ANSI ones do not!
Isn't it nice to have standards!

These colour termcap sequences can be put into your termcap entries if
you like. However, the simple way is to include in the Makefile the
definition of the symbols ANSI_VT, ANSI_XTERM or ANSI_ALL. The danger
here is mainly for xterm usage, since defining ANSI_XTERM or ANSI_ALL
implies also other standard escape sequences, including the one to switch
between 80 and 132 columns. Such use therefore requires ensuring that
you are using colxterm in a mode allowing 132 columns and are running as
a 24*80/27*132 Model 5 (or a 24*80/24*132 Model 6, special to CERN and
only compiled in with -DDENSE set in the makefile flags).

The moral of all this is that you can happily try the extended version
on VT-compatible terminals or emulators, but don't try with xterm unless
you understand what you are doing!

In using the extended version you may be running a program which allows
you to use extended highlighting for text that you are changing or inserting.
In such cases there are special escape sequences to choose the input
characteristics. In what I distribute as a map3270 file these are all
the ESCape key followed by a single letter as follows :-

b       Blinking
r       Reverse Video
u       Underscore
B       Blue
R       Red
P       Pink
G       Green
T       Turquoise
Y       Yellow
N       Neutral (black on white or white on black)

You can also choose to input text in the current default mode, which is
the mode defined for the current field, if defined, otherwise the default
colour (normally plain green text) or to have the text put in according to
what is already on the screen (which applies whether you are in replace
or insert mode). Again, this is done by the ESCape key then

v       variable highlighting, i.e. matching the text of the cursor position.
f       fixed highlighting, i.e. as specified for the current field.
V       variable colour, i.e. matching the text of the cursor position.
F       fixed colour, i.e. as specified for the current field.

The initial setting is for variable highlighting, i.e. matching whatever
is already at the cursor position.

The present version has many shortcomings :-

1. To do colour it has to reply to "Write Structured Field" requests
   from the IBM. It accepts only two such requests: the initial global
   query and the "Set Reply Mode" which allows a user to enter data in
   an extended mode (underscore, blinking or reverse video in any of
   the eight colours of an IBM 3270 display). Other requests (have not yet
   seen any) plus programs wanting REAL structured fields, will not work.

2. If the IBM refuses the terminal type (3279-2-E) the program will not
   offer a simpler model.

3. It has NOT got IBM graphics, nor extended character sets.

4. I have done no testing with unformatted screens.
