class: VT100TerminalView
added: #colorAtIndex:bright:
removed: #colorAtIndex:
changed: #displayMode:
--- a/VT100TerminalView.st Wed Jul 24 12:41:24 2013 +0200
+++ b/VT100TerminalView.st Wed Jul 24 15:49:10 2013 +0200
@@ -144,22 +144,32 @@
!VT100TerminalView methodsFor:'defaults'!
-colorAtIndex:idx
- |colorName colorModifier clr|
+colorAtIndex:idx bright:bright
+ |rgb|
+
+ rgb := #(
+ #( 0 0 0 ) "/ black
+ #(170 0 0) "/ red
+ #(0 170 0) "/ green
+ #(170 85 0) "/ yellow
+ #(0 0 170) "/ blue
+ #(170 0 170) "/ magenta
+ #(0 170 170 ) "/ cyan
+ #(170 170 170) "/ white ).
- colorName := #(black red green yellow blue magenta cyan white) at:idx.
- self backgroundColor brightness < 0.5 ifTrue:[
- "/ dark backgrounds
- colorModifier := #(nil nil nil nil lightened nil nil nil) at:idx.
- ] ifFalse:[
- "/ bright backgrounds
- colorModifier := #(nil nil darkened darkened nil darkened darkened nil) at:idx.
- ].
- clr := Color perform:colorName.
- colorModifier notNil ifTrue:[
- clr := clr perform:colorModifier
- ].
- ^ clr
+ #( 85 85 85 ) "/ black - darkGray
+ #(255 85 85) "/ red
+ #(85 255 85) "/ green
+ #(255 255 85) "/ yellow
+ #(85 85 255) "/ blue
+ #(255 85 255) "/ magenta
+ #(85 255 255 ) "/ cyan
+ #(255 255 255) "/ white
+ ).
+
+ ^ Color
+ perform: #'redbyte:greenByte:blueByte:'
+ withArguments:(rgb at:(idx + (bright ifTrue:[8] ifFalse:[0]))).
!
vt100AlternativeKeyCodes
@@ -311,6 +321,16 @@
].
^ self.
].
+ p1 == 2 ifTrue:[
+ "/ faint - unsupported
+ ^ self.
+ ].
+ p1 == 3 ifTrue:[
+ "/ ESC-[-3-m -> italic
+
+ self italic.
+ ^ self.
+ ].
p1 == 4 ifTrue:[
"/ ESC-[-4-m -> underline
@@ -323,6 +343,10 @@
self color:Color blue.
^ self.
].
+ p1 == 6 ifTrue:[
+ "/ ESC-[-5-m -> blink rapid - unsupported
+ ^ self.
+ ].
p1 == 7 ifTrue:[
"/ ESC-[-7-m -> reverse
@@ -333,16 +357,63 @@
"/ ESC-[-8-m -> invisible
^ self.
].
+ p1 == 9 ifTrue:[
+ "/ ESC-[-9-m -> crossed out - unsupported
+ ^ self.
+ ].
+ p1 == 10 ifTrue:[
+ "/ ESC-[-10-m -> primary font - unsupported
+ ^ self.
+ ].
+ (p1 between:11 and:19) ifTrue:[
+ "/ alternate fonts - unsupported
+ ^ self.
+ ].
+ p1 == 20 ifTrue:[
+ "/ fraktur - unsupported
+ ^ self.
+ ].
+ p1 == 21 ifTrue:[
+ "/ ESC-[-21-m -> not bold
+ self notBold.
+ ^ self.
+ ].
+ p1 == 23 ifTrue:[
+ "/ ESC-[-23-m -> not italic
+ self notItalic.
+ ^ self.
+ ].
+ p1 == 24 ifTrue:[
+ "/ ESC-[-24-m -> not underline
+ self notUnderline.
+ ^ self.
+ ].
+ p1 == 25 ifTrue:[
+ "/ ESC-[-25-m -> not blinking - unsupported
+ ^ self.
+ ].
+ p1 == 28 ifTrue:[
+ "/ ESC-[-28-m -> not invisible/reveal - unsupported
+ ^ self.
+ ].
+ p1 == 29 ifTrue:[
+ "/ ESC-[-29-m -> not crossed out - unsupported
+ ^ self.
+ ].
(p1 between:30 and:37) ifTrue:[
"/ ESC-[-30-m -> black fg color
"/ ESC-[-31-m -> red fg color
"/ ...
"/ ESC-[-37-m -> white fg color
noColors ifFalse:[
- self color:(self colorAtIndex:(p1-30+1)).
+ self color:(self colorAtIndex:(p1-30+1) bright:false).
].
^ self.
].
+ p1 == 38 ifTrue:[
+ "/ xterm 256 color - unsupported
+ ^ self
+ ].
p1 == 39 ifTrue:[
"/ normal fg color
self color:nil.
@@ -353,25 +424,31 @@
"/ ...
"/ ESC-[-47-m -> white bg color
noColors ifFalse:[
- self bgColor:(self colorAtIndex:(p1-40+1)).
+ self bgColor:(self colorAtIndex:(p1-40+1) bright:false).
].
^ self.
].
+ p1 == 48 ifTrue:[
+ "/ xterm 256 bg color - unsupported
+ ^ self
+ ].
p1 == 49 ifTrue:[
- "/ normal fg color
+ "/ normal bg color
self bgColor:nil.
^ self
].
(p1 between:90 and:97) ifTrue:[
+ "/ fg color high intensity
noColors ifFalse:[
- self color:(self colorAtIndex:(p1-90+1)) lightened.
+ self color:(self colorAtIndex:(p1-90+1) bright:true).
].
^ self.
].
(p1 between:100 and:107) ifTrue:[
+ "/ bg color high intensity
noColors ifFalse:[
- self bgColor:(self colorAtIndex:(p1-100+1)) lightened.
+ self bgColor:(self colorAtIndex:(p1-100+1) bright:true).
].
^ self.
].
@@ -1195,10 +1272,10 @@
!VT100TerminalView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.56 2013-07-24 09:54:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.57 2013-07-24 13:49:10 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.56 2013-07-24 09:54:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.57 2013-07-24 13:49:10 cg Exp $'
! !