[Info-vax] escape sequences, cursor positioning
Johnny Billquist
bqt at update.uu.se
Mon Jan 12 18:00:45 EST 2009
JF Mezei skrev:
> David J Dachtera wrote:
> Now, looking at the original screen display for something at line 8
> column 34:
>
> •[8;32H•[;1;7m •[8;34H 0.00•[9;2H etc
>
> So, it moves to column 32, sets attribute to bold (1) and reverse video
> (8) writes 2 spaces, then moves to 8;34, and writes the field contents
> (2 spaces followed by 0.00 and then moves on to the next field.
>
> So it appears that during entry, you can rewrite the contents at that
> location of the screen and the video attributes are preserved.
Bzzt. No.
Apart from the fact that the display driver seems a bit stupid (why do a cursor
movement to exactly the place you're already at?), what you need to remember is
that when you set attributes, they remain active until changed. Moving the
cursor around won't change that.
So the above sequence will move to (8,32), turn off all attributes, turn on
bold(1) and reverse(7), write two spaces with these attributes, move the cursor
to (8,34) (where it is already at after the previous two spaces), write " 0.00"
still with the same attributes previously set, and then move on to (9,2), and so
on...
And why I say turn off all attibutes - please note the sequence. It is:
<CSI>;1;7m
The initial ; means that you have a (silent) zero first of all. More explicitly,
it would be written:
<CSI>0;1;7m
(And I use <CSI> here, since that's the correct name of the sequence. And it can
be sent either as "<ESC>[" or as "<CSI>". The latter is an 8-bit code with the
octal value of 233. The latter will only work if your terminal actually
understands 8-bit control codes.)
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt at softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
More information about the Info-vax
mailing list