9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Douglas A. Gwyn" <gwyn@arl.army.mil>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] vt
Date: Mon,  9 Apr 2001 08:36:14 +0000	[thread overview]
Message-ID: <3ACE4F36.DF031C72@arl.army.mil> (raw)
In-Reply-To: <20010406170414.76D0019A47@mail.cse.psu.edu>

presotto@plan9.bell-labs.com wrote:
> Is there independent confirmation out there that this is a good or
> at least a harmless thing to do?
> From: Micah Stetson <micah@cnm-vra.com>
> /mnt/wrap/sys/src/cmd/vt/vt.c:581 c /sys/src/cmd/vt/vt.c:581
> <                                                               clear(Rpt(pt(0, 0), pt(x, ymax+1)));
> ---
> >                                                               clear(Rpt(pt(0, 0), pt(xmax+1, y)));

That is indeed a correct fix to a genuine bug.

Here are some additional errors in the VT100 display emulation (/sys/src/cmd/vt/vt.c):
 * Known bugs:
	...
should add:
 *
 * 5. Cursor key sequences aren't selected by keypad application mode.
 *
 * 6. "VT220" mode (-2) currently just switches the default cursor key
 *	functions (same as -a); it's still just a VT100 emulation.
 *
 * 7. VT52 mode and a few other rarely used features are not implemented.
...
		case '\011':		/* tab to next tab stop; if none, tab modulo 8 */
			...
			else
				x = (x|7)+1;
should be:
		case '\011':		/* tab to next tab stop; if none, to right margin */
			...
			else
				x = xmax;
...
		case '\030':	/* CAN: cancel escape sequence */
		case '\031':	/* EM: cancel escape sequence, display checkerboard */
should be:
		case '\030':	/* CAN: cancel escape sequence, display checkerboard (not implemented) */
		case '\031':	/* EM */
...
		case '\033':
			switch(get_next_char()){
should add:
			/*
			 * 1 - graphic processor option on (no-op; not installed)
			 */
			case '1':
				break;

			/*
			 * 2 - graphic processor option off (no-op; not installed)
			 */
			case '2':
				break;

...
			 * D - active position down a line, scroll if at bottom margin.
should add:
			 * (Original VT100 had a bug: tracked new-line/line-feed mode.)
...
			 * H - set tab stop at current column.
			 * (This is move to home in some VT100 docs, but that use seems deprecated.  -rsc)
should be:
			 * H - set tab stop at current column.
			 * (This is cursor home in VT52 mode (not implemented).)
...
			 * Z - identification.  the terminal
				...
				sendnchars2(5, "\033[?6c");
denotes VT102, which supports insert mode, delete-character, etc. which are not implemented;
should be:
			 * Z - identification.  The terminal
				...
				sendnchars2(7, "\033[?1;2c");	/* VT100 with AVO option */
...
			 * > - set numeric keypad mode on
should be:
			 * > - set numeric keypad mode on (not implemented)
...
			 * = - set numeric keypad mode off
should be:
			 * = - set numeric keypad mode off (not implemented)
...
			case '#':
				...
				case '6':		/* Double-width line */
should be:
				case '5':		/* single-width single-height line */
				case '6':		/* Double-width line */
				case '7':		/* screen print */
...
					 * c - same as ESC Z: who are you?
should be:
					 * c - same as ESC Z: what are you?
...
					case 'l':
						...
							case 25:	/* cursor off */
								cursoron = 0;
								cursoff();
								break;
							case 30:	/* screen invisible */
should be:
					case 'l':
						...
							case 30:	/* screen invisible (not supported through VT220 if ever) */
...
						}else if(noperand == 2){
							switch(operand[1]){
							case 1:	/* set cursor key to cursor */
								break;
							case 2:	/* set VT52 */
should be:
						}else while(--noperand > 0){
							switch(operand[noperand]){
							case 1:	/* set cursor keys to send ANSI functions: ESC [ A..D */
								break;
							case 2:	/* set VT52 mode (not implemented) */
...
							case 6:	/* set origin to absolute */
								originrelative = 0;
should add:
								x = y = 0;
...
							case 9:	/* reset interlacing mode */
								break;
should add:
							case 25:	/* text cursor off (VT220) */
								cursoron = 0;
								cursoff();
								break;
...
					case 'h':
						...
							case 25:	/* cursor on */
								cursoron = 1;
								curson(0);
								break;
							case 30:	/* screen visible */
should be:
					case 'h':
						...
							case 30:	/* screen visible (not supported through VT220 if ever) */
...
						}else if(noperand == 2){
							switch(operand[1]){
							case 1:	/* set cursor key to application */
								break;
should be:
						}else while(--noperand > 0){
							switch(operand[noperand]){
							case 1:	/* set cursor keys to send application function: ESC O A..D */
								break;
...
							case 5:	/* set reverse video */
should be:
							case 5:	/* set screen to reverse video (not implemented) */
...
							case 6:	/* set origin to relative */
								originrelative = 1;
should add:
								x = 0;
								y = yscrmin;
...
					/*
					 * Turn on list of LEDs; turn off others.
					 */
					case 'q':
						print("LED\n");
should be:
					/*
					 * n - request various reports
					 */
					case 'n':
						switch(operand[0]){
						case 5:	/* status */
							sendnchars2(4, "\033[0n");	/* terminal ok */
							break;
						case 6:	/* cursor position */
							sendnchars2(sprintf(buf, "\033[%d;%dR",
								originrelative ? y+1 - yscrmin : y+1, x+1), buf);
							break;
						}
						break;

					/*
					 * q - turn on list of LEDs; turn off others.
					 */
					case 'q':
//						print("LED\n");
...
					case 'r':
						...
						case 2:
							yscrmax = operand[1]-1;
should add:
							if(yscrmax > ymax)
								yscrmax = ymax;
...
Between cases 'r' and 'A' add:

					/*
					 * x - report terminal parameters
					 */
					case 'x':
						sendnchars2(20, "\033[3;1;1;120;120;1;0x");
						break;

					/*
					 * y - invoke confidence test
					 */
					case 'y':
						break;
...
					 * D - cursor left (I think)
should be:
					 * D - cursor left
...
					 * H and f - cursor motion.  operand[0] is row and
					 * operand[1] the row, origin 1
should be:
					 * H and f - cursor motion.  operand[0] is row and
					 * operand[1] is column, origin 1.
...
					case 'K':
						...
							case 2:
								clear(Rpt(pt(x, y), pt(xmax+1, y+1)));
should be:
					case 'K':
						...
							case 2:
								clear(Rpt(pt(0, y), pt(xmax+1, y+1)));
...
					 * L - insert a line at cursor position
should be:
					 * L - insert a line at cursor position (VT102 and later)
...
					 * M - delete a line at the cursor position
should be:
					 * M - delete a line at cursor position (VT102 and later)
...
					case '=':
						...
						break;
should be deleted; it doesn't correspond to any model through VT220.

By the way, there are a lot of bogus VT100 termcap entries in circulation.
Here are the relevant entries from the last snapshot of BRL's official
termcap database:

#
# DEC VT100 with variations for Advanced Video Option and screen width.
# The following SET-UP modes are assumed for normal operation:
#	ANSI_MODE	AUTO_XON/XOFF_ON	NEWLINE_OFF	80_COLUMNS
#	WRAP_AROUND_ON
# Other SET-UP modes may be set for operator convenience or communication
# requirements; I recommend
#	SMOOTH_SCROLL	AUTOREPEAT_ON	BLOCK_CURSOR	MARGIN_BELL_OFF
#	SHIFTED_3_#
# Unless you have a graphics add-on such as Digital Engineering's VT640
# (and even then, whenever it can be arranged!) you should set
#	INTERLACE_OFF
# Hardware tabs are assumed to be set every 8 columns; they can be set up
# by the "reset", "tset", or "tabs" utilities (use vt100-x, 132 columns, for
# this).  I have included some compatible code in "rs" for the VT640 if you
# have one.  No delays are specified; use "stty ixon -ixany" to enable DC3/DC1
# flow control!
# Thanks to elsie!ado (Arthur David Olson) for numerous improvements.
d0|vt100|DEC VT100 with AVO:\
	:ae=^O:as=^N:bl=^G:cd=\E[J:ce=\E[K:cm=\E[%i%d;%dH:co#80:cr=^M:\
	:cs=\E[%i%d;%dr:ct=\E[3g:DO=\E[%dB:do=^J:ho=\E[H:is=\E<\E)0:it#8:\
	:k0=\EOP:k1=\EOQ:k2=\EOR:k3=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\
	:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l0=PF1:l1=PF2:l2=PF3:l3=PF4:LE=\E[%dD:\
	:le=^H:li#24:ll=\E[24H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:ms:nd=\E[C:\
	:nw=\EE:rc=\E8:RI=\E[%dC:\
	:rs=^X\E<\E2\E[?9h^]\E^L^X\E[20l\E[?3;9;6l\E[r\E[m\E[q\E(B^O\E)0\E>:\
	:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:ti=\E[?7l:\
	:te=150\E[?7h:ue=\E[m:UP=\E[%dA:up=\EM:us=\E[4m:vt#3:xo:\
	:cl=\E[H\E[J:\
	:bs:kn#4:pt:
dv|vt100-v|DEC VT100 without AVO:\
	:ue@:us@:\
	:tc=vt100:
d8|vt100-w|DEC VT100 with AVO in 132-column mode:\
	:co#132:ct=\E[?3h\E[g:\
	:rs=^X\E<\E2\E[?9h^]\E^L^X\E[20l\E[?9;6l\E[?3h\
\E[r\E[m\E[q\E(B^O\E)0\E>:\
	:tc=vt100:
d9|vt100-x|DEC VT100 without AVO in 132-column mode:\
	:ct=\E[?3h\E[g:li#14:ll=\E[14H:ue@:us@:\
	:tc=vt100-w:
#
# DEC VT100 with visible bell from John I. Leonard <irv@BRL-TGR.ARPA>
db|vt100-vb|DEC VT100 with visual bell:\
	:vb=\E[?5h\200\200\200\200\200\200\200\200\200\200\200\200\200\E[?5l:\
	:tc=vt100:
# Note: above assumes you like dark background; following added by DAG:
dB|vt100-rvb|DEC VT100 with reverse video and visual bell:\
	:vb=\E[?5l\200\200\200\200\200\200\200\200\200\200\200\200\200\E[?5h:\
	:tc=vt100:
#
# DEC VT102 from Eric K. Bustad <ihnp4!eric.bustad>
dy|vt102|DEC VT102:\
	:im=\E[4h:ei=\E[4l:al=\E[1L:dl=\E[1M:dc=\E[1P:tc=vt100:
dz|vt102-w|DEC VT102, 132 columns:\
	:im=\E[4h:ei=\E[4l:al=\E[1L:dl=\E[1M:dc=\E[1P:tc=vt100-w:
#
# vt-220 termcap courtesy of Davis, Polk & Wardwell
#
d2|vt220|vt-220|pt220|pt-220|dec vt220:\
	:co#80:tc=vt220-x:
d3|vt220w|vt-220w|pt220w|pt-220w|dec vt220w:\
	:co#132:tc=vt220-x:
d4|vt220-x|dec vt220 generic:\
	:ae=4\E(B:al=\E[L:am:as=2\E(<:bl=^G:bs:\
	:cd=50\E[J:ce=3\E[K:cl=50\E[;H\E[2J:\
	:cm=10\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\
	:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ho=\E[H:\
	:if=/usr/lib/tabset/vt100:im=\E[4h:is=\E[1;24r\E[24;1H:\
	:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\
	:k5=\E[17~:k6=\E[18~:k7=\E[19~:k8=\E[20~:\
	:k9=\E[21~:k10=\E[22~:k11=\E[23~:k12=\E[24~:\
	:k13=\E[25~:k14=\E[26~:k15=\E[28~:k16=\E[29~:\
	:k17=\E[31~:k18=\E[32~:k19=\E[33~:k20=\E[34~:\
	:kb=^?:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:\
	:le=^H:li#24:mb=2\E[5m:md=2\E[1m:me=2\E[m:mi:mr=2\E[7m:\
	:nd=\E[C:nl=^J:pt:\
	:rc=\E8:rf=/usr/lib/tabset/vt100:\
	:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\
	:sc=\E7:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:\
	:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:vt#3:xn:


  reply	other threads:[~2001-04-09  8:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-06 17:04 presotto
2001-04-09  8:36 ` Douglas A. Gwyn [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-04-09 15:49 forsyth
2001-04-18 14:06 ` David Lukes
2001-04-18 18:55   ` Boyd Roberts
2001-04-09  9:07 Russ Cox
2001-04-09 15:34 ` Douglas A. Gwyn
2001-04-10  9:00   ` Boyd Roberts
2001-04-07  1:22 presotto
2001-04-09  8:36 ` Boyd Roberts
2001-04-09 15:22   ` Douglas A. Gwyn
2001-04-10  8:59     ` Boyd Roberts
2001-04-04  6:08 Micah Stetson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ACE4F36.DF031C72@arl.army.mil \
    --to=gwyn@arl.army.mil \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).