VT52TerminalView.st
author Claus Gittinger <cg@exept.de>
Wed, 10 Jun 1998 17:14:15 +0200
changeset 932 af0236d38242
parent 927 b0b5b368e80f
child 949 1a6071a5c370
permissions -rw-r--r--
*** empty log message ***

TerminalView subclass:#VT52TerminalView
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Views-TerminalViews'
!

!VT52TerminalView class methodsFor:'documentation'!

documentation
"
    VT52 terminal

    [start with:]
        VT52TerminalView openShell
"

! !

!VT52TerminalView methodsFor:'defaults'!

vt52Codes
    ^ #(
         ( '\eA'  #doCursorUp    )
         ( '\eB'  #doCursorLeft  )
         ( '\eC'  #doCursorRight  )
         ( '\eD'  #doCursorDown )
         ( '\eH'  #doCursorHome  )
         ( '\eJ'  #doClearToEnd  )
         ( '\r'   #doCursorReturn  )
         ( '\n'   #doCursorNewLine  )
         ( '\b'   #doBackspace  )
       )

    "Modified: / 9.6.1998 / 20:47:50 / cg"
!

vt52KeyCodes
    ^ IdentityDictionary withKeysAndValues:
        #(
             #CursorUp    '\eA'
             #CursorDown  '\eB'
             #CursorRight '\eC'
             #CursorLeft  '\eD'
             #Home        '\eH'
             #Escape      '\e'
             #BackSpace   '\b'
             #Return      '\r'
             #Delete      '\0377'
         )

    "Modified: / 10.6.1998 / 14:19:27 / cg"
! !

!VT52TerminalView methodsFor:'initialization'!

initialize
    super initialize.
    self escapeSequences:(self vt52Codes)


!

initializeEscapeSequences
    self escapeSequences:(self vt52Codes)


!

initializeKeyboardSequences
    kbdSequences := (self vt52KeyCodes)


! !

!VT52TerminalView methodsFor:'processing - input'!

nextPut:aCharacter
    |where next|

"/    Transcript showCR:aCharacter asciiValue.

    where := currentTree ? escapeSequenceTree.
"/    Transcript showCR:'current: ' , where storeString.

    next := where at:aCharacter ifAbsent:nil.
"/    Transcript showCR:'next: ' , next storeString.
    next isNil ifTrue:[
        "/ something collected so far ?
        currentSequence notNil ifTrue:[
            self halt.
        ].

        self replaceCharAtCursor:aCharacter.
        "/ self cursorRight.

        currentTree := nil.
        ^ self.
    ].

    next isSymbol ifTrue:[
        self perform:next.
        currentTree := nil.
        ^ self
    ].
    currentTree := next

    "Created: / 10.6.1998 / 16:25:58 / cg"
! !

!VT52TerminalView methodsFor:'queries'!

terminalType
    ^ #vt52

    "Created: / 10.6.1998 / 16:22:46 / cg"
! !

!VT52TerminalView class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/VT52TerminalView.st,v 1.5 1998-06-10 15:14:15 cg Exp $'
! !