- live browsing of Self object memory -

lobby traitstty

CopyDowns: vector

CreatorPath: traits tty

Module: tty

parent* = traits oddball
initialize =
( 
    foreignCodeDB initialize.
    termcap getenv: (os environmentAt: 'TERM' IfFail: 'dumb')
            IfFail: [].
    termcap initializeCapabilities.

    "If the tty type is 'sun-cmd', underlining and standout mode
     are visible in TermcapMode only. Entering TermcapMode has
     the unpleasant side effect that scroll bars disappear."

    name)

operations

backSpace = ( 8 asCharacter print)
clear = ( termcap clearScreen print. self)
clearToEOL = ( termcap clearToEndOfLine print. self)
endEmphasize =
( | token = '}' |
    name = 'sun-cmd' ifTrue: [
       ^inTermcapMode ifTrue: [endStandout] False: [ token print]].
    hasStandout       ifTrue: [^endStandout].
    hasUnderscoring   ifTrue: [^endUnderscore].
    token print)
endStandout = ( termcap endStandout print. self)
endTermcapMode =
( 
     termcap endTermcapMode   print.
    inTermcapMode: false. self)
endUnderscore = ( termcap endUnderscore print. self)
goto: =
( 
    termcap goto isPresent ifTrue: [
        (termcap goto: termcap goto value Col: pt x Row: pt y) print.
    ] False: [ 
        error: 'no goto capability'.
    ])
hasStandout =
( 
     termcap startStandout isPresent
    && [ termcap endStandout   isPresent ])
hasTermcapMode =
( 
     termcap startTermcapMode isPresent
    && [ termcap endTermcapMode   isPresent ])
hasUnderscoring =
( 
     termcap startUnderscore isPresent
    && [ termcap endUnderscore   isPresent ])
height = ( termcap height isPresent ifTrue: termcap height False: 24)
name = ( termcap name)
printMsg:Do: =
( | r |
    msg print. 
    r: blk value.
    termcap supportsBackspace value ifTrue: [
       msg size do: [ backSpace ]. clearToEOL 
    ] False: [ ' ' print ].
    r)
startEmphasize =
( | token = '{' |
    name = 'sun-cmd' ifTrue: [
       ^inTermcapMode ifTrue: [startStandout] False: [ token print]].
    hasStandout       ifTrue: [^startStandout].
    hasUnderscoring   ifTrue: [^startUnderscore].
    token print)
startStandout = ( termcap startStandout print. self)
startTermcapMode =
( 
     termcap startTermcapMode print. 
    inTermcapMode: true. self)
startUnderscore = ( termcap startUnderscore print. self)
width = ( termcap width isPresent ifTrue: termcap width False: 80)

state

inTermcapMode = false