From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: "Douglas A. Gwyn" Message-ID: <3ACE4F36.DF031C72@arl.army.mil> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <20010406170414.76D0019A47@mail.cse.psu.edu> Subject: Re: [9fans] vt Date: Mon, 9 Apr 2001 08:36:14 +0000 Topicbox-Message-UUID: 7af08d9e-eac9-11e9-9e20-41e7f4b1d025 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 > /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 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 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: