eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'VT100TerminalView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: VT100TerminalView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--ListView
                  |
                  +--TextView
                     |
                     +--EditTextView
                        |
                        +--TextCollector
                           |
                           +--TerminalView
                              |
                              +--VT100TerminalView

Package:
stx:libwidg2
Category:
Views-TerminalViews
Version:
rev: 1.92 date: 2024/03/25 14:01:22
user: cg
file: VT100TerminalView.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


A VT100 terminal emulator.
Most of the functionality is inherited from my superclass,
I redefine/specialize certain methods for VT100 escape sequences
and vt100 keyboard codes

BUGS:
    VT100 wrapMode (at right margin) is not supported
    this may lead to wrong display when a vi is started in a small window.

copyright

COPYRIGHT (c) 1998 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

ansiEscapes

see also: http://www.vt100.net/docs/vt100-ug/chapter3.html ANSI ESCAPE SEQUENCES =============================================================================== Wherever you see '#', that should be replaced by the appropriate number. ESC code sequence Function ------------------- --------------------------- Cursor Controls: ESC[#;#H or ESC[#;#f Moves cusor to line #, column # ESC[#A Moves cursor up # lines ESC[#B Moves cursor down # lines ESC[#C Moves cursor forward # spaces ESC[#D Moves cursor back # spaces ESC[#;#R Reports current cursor line & column ESC[s Saves cursor position for recall later ESC[u Return to saved cursor position Erase Functions: ESC[2J Clear screen and home cursor ESC[K Clear to end of line Set Graphics Rendition: ESC[#;#;....;#m Set display attributes where # is 0 for normal display 1 for bold on 4 underline (mono only) 5 blink on 7 reverse video on 8 nondisplayed (invisible) 30 black foreground 31 faint red foreground 32 faint green foreground 33 faint yellow foreground 34 faint blue foreground 35 faint magenta foreground 36 faint cyan foreground 37 faint white (grey) foreground 39 reset to default foreground 40 black background 41 red background 42 green background 43 yellow background 44 blue background 45 magenta background 46 cyan background 47 white background 49 reset to default background 90 grey foreground 91 bright red foreground 92 bright green foreground 99 bright yellow foreground 94 bright blue foreground 95 bright magenta foreground 96 bright cyan foreground 97 bright white foreground 100 grey background 101 bright red background 102 bright green background 109 bright yellow background 104 bright blue background 105 bright magenta background 106 bright cyan background 107 bright white background ESC[=#;7h or Put screen in indicated mode where # is ESC[=h or 0 for 40 x 25 black & white ESC[=0h or 1 for 40 x 25 color ESC[?7h 2 for 80 x 25 b&w 3 for 80 x 25 color 4 for 320 x 200 color graphics 5 for 320 x 200 b & w graphics 6 for 640 x 200 b & w graphics 7 to wrap at end of line ESC[=#;7l or ESC[=l or Resets mode # set with above command ESC[=0l or ESC[?7l Keyboard Reassignments: ESC[#;#;...p Keyboard reassignment. The first ASCII or ESC[stringp code defines which code is to be or ESC[#;string;#; changed. The remaining codes define #;string;#p what it is to be changed to. E.g. Reassign the Q and q keys to the A and a keys (and vice versa). ESC [65;81p A becomes Q ESC [97;113p a becomes q ESC [81;65p Q becomes A ESC [113;97p q becomes a E.g. Reassign the F10 key to a DIR command. ESC [0;68;dir;13p The 0;68 is the extended ASCII code for the F10 key and 13 is the ASCII code for a carriage return. Other function key codes F1=59,F2=60,F3=61,F4=62,F5=63 F6=64,F7=65,F8=66,F9=67,F10=68

Class protocol:

queries
o  ansiColorAtIndex: idx bright: bright

o  ansiColorEscapeForColor: aColor forForeground: forFgBoolean
ansii color escapes are:
black fg: ESC[30m / bg: ESC[40m
dark red ESC[31m / bg: ESC[41m
dark green ESC[32m / bg: ESC[42m
dark yellow ESC[33m / bg: ESC[43m
dark blue
dark magenta
dark cyan
dark white eg. light grey). ESC[37m / bg: ESC[47m

bright black eg. darkGray fg: ESC[90m / bg: ESC[100m
bright red ESC[91m / bg: ESC[101m
bright green
bright yellow
bright blue
bright magenta
bright cyan
white ESC[97m / bg: ESC[107m

Usage example(s):

     self assert:(VT100TerminalView 
                    ansiColorEscapeForColor:Color red 
                    forForeground:true) = c'\x1B[91m'

     self assert:(VT100TerminalView 
                    ansiColorEscapeForColor:Color red 
                    forForeground:false) = c'\x1B[101m'

o  ansiColors
ansii color escapes are:
black fg: ESC[30m / bg: ESC[40m
dark red ESC[31m / bg: ESC[41m
dark green ESC[32m / bg: ESC[42m
dark yellow ESC[33m / bg: ESC[43m
dark blue
dark magenta
dark cyan
dark white eg. light grey). ESC[37m / bg: ESC[47m

bright black eg. darkGray fg: ESC[90m / bg: ESC[100m
bright red ESC[91m / bg: ESC[101m
bright green
bright yellow
bright blue
bright magenta
bright cyan
white ESC[97m / bg: ESC[107m

o  ansiColors2
map more common colors to ansii colors
(used to map st/x colors to escape codes (eg. for Logger)


Instance protocol:

defaults
o  colorAtIndex: idx bright: bright

o  vt100AlternativeKeyCodes
return the alternative vt100 keyCode table

o  vt100KeyCodes
return a vt100 keyCode table

functions
o  addLines
Add the appropriate number of blank lines (param 1)
at the cursor position.

o  addLines: aNumber
Add aNumber blank lines at the position indicated by the cursor.

o  clearLines: arg
Clear some part of the current line, as indicated by the first parameter:
0 - clear to EOL
1 - clear from beginning to cursorCol
2 - clear entire line

o  deleteCharacters
Delete the appropriate number of characters (param 1)
at the cursor position.

o  deleteLines
CSI <n> M
Delete the appropriate number of lines (param 1)
at the cursor position.

o  displayMode: p1
ESC-[-<param1>-m
Set the current display mode (emphasis) as specified by param 1.

o  doClearDisplay: arg
Clear some part of the current screen, as indicated by the first parameter.
0 - clear to endOfScreen
1 - clear from beginning of screen to cursorCol
2 - clear entire screen

o  doCursorNextLine: n

o  doCursorPreviousLine: n

o  insertCharacters
Insert the appropriate number of spaces (param 1) at the cursor position.

o  insertLines
CSI <n> L
Insert the appropriate number of lines (param 1) at the cursor position.

o  move
Move to the locations indicated by the first and second parameters.

o  moveRelative
Move to relative locations indicated by the first and second parameters.

o  moveToColumn
Move to the column indicated by the first.

o  moveToLine
Move to the line indicated by the first param.

o  moveToX: xLocation y: yLocation
Position the cursor at the location given by xLocation and yLocation.
Ignore the command if the parameters are outside the allowable range.

o  report
ESC[<p1>n
currently, only cursor position is supported (param 6)

Usage example(s):

report device status

Usage example(s):

report position

o  reportTerminalType
ESC[<p1>c
currently, only terimal type (param 0)
and cursor position is supported (param 6)

o  resetDefaults
Reset the default parameters

initialization
o  initialize
(comment from inherited method)
will vanish

o  initializeKeyboardSequences
setup my keyboard sequences for a vt100

misc
o  traceCSI: char

os functions (xterm)
o  osCommand
this is an xterm escape sequence, which controls
the window's title, icon, or other property

processing-input
o  addToParameter: char
The parameter char is a digit. Add it to the current parameter.

o  endOfSequence
private - reset state-machine at end of escape-sequence

o  evaluateProcessCharacter: char return: aSymbol
evaluate the return value of the process state method except for state 0

o  nextPut: char
process a character (i.e. from the shell's output)
Answer char.

o  processState0: char
next char in initial state
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotCSI2: char
next char after 'ESC [ ?' (CSI ?)
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotCSI2b: char
next char after 'ESC [ >' (CSI >)
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotCSI3: char
next char after 'ESC ('
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotCSI: char
next char after 'ESC> [' (CSI)
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotESC: char
next char after ESC
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotESC_SPACE: char
next char after 'ESC sp'
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotReturn: char
next char after CR
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotXTERMCSI2: char
next char after 'ESC ] ;'
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

o  processStateGotXTERMCSI: char
next char after 'ESC ]'
change state or processing character;
return
#waitForNextChar - state was changed and wait for next characters
#sequenceComplete - command processed
#unknown - unknown character for this state

queries
o  getParameter: nr withDefault: default
Modified (format): / 01-03-2021 / 00:15:07 / cg

o  terminalType
returns a string describing this terminal (usually, this is
passed down to the shell as TERM environment variable).
Here, 'vt100' is returned.



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 08:53:25 GMT