--- a/MenuPanel.st Tue Sep 13 07:02:39 2016 +0200
+++ b/MenuPanel.st Wed Sep 14 06:50:14 2016 +0200
@@ -861,12 +861,10 @@
^ anImage
].
- Images isNil ifTrue:[ Images := WeakIdentityDictionary new ].
-
- (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
- Images at:aDevice put:(deviceImages := Dictionary new)
- ].
-
+ Images isNil ifTrue:[
+ Images := WeakIdentityDictionary new.
+ ].
+ deviceImages := Images at:aDevice ifAbsentPut:[Dictionary new].
^ deviceImages at:anImage ifAbsentPut:[anImage copy onDevice:aDevice].
!
--- a/TerminalView.st Tue Sep 13 07:02:39 2016 +0200
+++ b/TerminalView.st Wed Sep 14 06:50:14 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1998 by eXept Software AG
All Rights Reserved
@@ -1269,6 +1271,13 @@
!TerminalView methodsFor:'functions'!
+autoMargin:aBoolean
+ "set/clear autowrap at end of line (not yet fully implemented).
+ This may come from a CSI sequence, or set programmatically."
+
+ autoWrapFlag := aBoolean
+!
+
doBackspace
self cursorLeft.
self replaceCharAtCursor:(Character space).
@@ -2305,7 +2314,8 @@
"/^ self.
access critical:[
- |index controlCharIndex stringWithOutControl crnlFollows|
+ |index controlCharIndex stringWithOutControl crnlFollows
+ nFit nCharsInLine charIdx oldCollectSize|
index := 1.
[index <= count] whileTrue:[
@@ -2350,20 +2360,47 @@
stringWithOutControl := stringWithOutControl utf8Decoded
].
].
- (cursorCol + outstandingLine size + stringWithOutControl size) >= numberOfColumns ifTrue:[
+ nCharsInLine := stringWithOutControl size.
+ (autoWrapFlag
+ and:[ (cursorCol + outstandingLine size + nCharsInLine) >= numberOfColumns ]
+ ) ifTrue:[
+ charIdx := 1.
+ nFit := numberOfColumns - outstandingLine size - cursorCol - 1.
+ nFit > 0 ifTrue:[
+ access critical:[
+ outstandingLine size > 0 ifTrue:[
+ outstandingLine := outstandingLine , (stringWithOutControl copyTo:nFit).
+ ] ifFalse:[
+ outstandingLine := (stringWithOutControl copyTo:nFit).
+ ].
+ ].
+ charIdx := nFit + 1.
+ ].
+ "/ Transcript show:'idx: '; show:charIdx; show:' n:'; showCR:nCharsInLine.
+ oldCollectSize := collectSize.
+ collectSize := 32*1024.
"/ characterwise, for correct wrap handling at line end
- stringWithOutControl do:[:eachCharacter |
+ [charIdx <= nCharsInLine] whileTrue:[
+ |eachCharacter|
+
+ eachCharacter := stringWithOutControl at:charIdx.
self nextPut:eachCharacter.
- self endEntry.
+"/ self endEntry.
cursorCol >= numberOfColumns ifTrue:[
+ "/ self endEntry.
self validateCursorCol:cursorCol inLine:cursorLine.
+ "/ Transcript show:'col now: '; showCR:cursorCol.
+ nFit := numberOfColumns - cursorCol - charIdx.
+ "/ Transcript show:'nFit now: '; showCR:nFit.
].
+ charIdx := charIdx + 1.
].
crnlFollows ifTrue:[
self nextPut:Character return.
self nextPut:Character nl.
].
self endEntry.
+ collectSize := oldCollectSize.
] ifFalse:[
Debug ifTrue:[
--- a/VT100TerminalView.st Tue Sep 13 07:02:39 2016 +0200
+++ b/VT100TerminalView.st Wed Sep 14 06:50:14 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1998 by eXept Software AG
All Rights Reserved
@@ -161,9 +163,8 @@
[see also:]
VT52TerminalView
TelnetTool
+ http://vt100.net/docs/vt220-rm/chapter4.html
"
-
-
! !
!VT100TerminalView methodsFor:'defaults'!
@@ -278,12 +279,6 @@
"Created: / 10.6.1998 / 14:49:30 / cg"
!
-autoMargin:aBoolean
- "set/clear autowrap at end of line (not yet implemented)"
-
- autoWrapFlag := aBoolean
-!
-
clearLines:arg
"Clear some part of the current line, as indicated by the first parameter:
0 - clear to EOL
@@ -856,11 +851,13 @@
!
processState0:char
- " change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
char codePoint < 32 ifTrue:[
(char == Character esc) ifTrue:[
@@ -938,11 +935,13 @@
!
processStateGotCSI2:char
-" change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
char == $; ifTrue: [
currentParam := (currentParam + 1) min: 8.
@@ -955,35 +954,47 @@
TraceCSI == true ifTrue:[ self traceCSI:char ].
(char == $l or:[char == $h]) ifTrue: [
- "/ (parameters at: 1) = 1 ifTrue: [app_cur_keys:(char == $h)].
- "/ (parameters at: 1) = 2 ifTrue: [mode132:(char == $h)].
- "/ (parameters at: 1) = 4 ifTrue: [smoothScroll:(char == $h)].
- "/ (parameters at: 1) = 5 ifTrue: [reverseVideo:(char == $h)].
- "/ (parameters at: 1) = 6 ifTrue: [decom:(char == $h)].
+ "/ (parameters at: 1) = 1 ifTrue: [app_cur_keys:(char == $h) "DECCKM"].
+ "/ (parameters at: 1) = 2 ifTrue: [vt52mode:(char == $l) "DECANM"].
+ "/ (parameters at: 1) = 3 ifTrue: [mode132:(char == $h) "DECCOLM"].
+ "/ (parameters at: 1) = 4 ifTrue: [smoothScroll:(char == $h) "DECSCLM"].
+ "/ (parameters at: 1) = 5 ifTrue: [reverseVideo:(char == $h) "DECSCNM"].
+ "/ (parameters at: 1) = 6 ifTrue: [originMode:(char == $h) "DECOM"].
+ "/ (parameters at: 1) = 8 ifTrue: [autoKbdRepeat:(char == $h) "DECARM"].
+ "/ (parameters at: 1) = 25 ifTrue: [cursorVisible:(char == $h) "DECTCEM"].
self endEntry.
- (parameters at: 1) = 7 ifTrue: [self autoMargin:(char == $h)].
+ (parameters at: 1) = 7 ifTrue: [self autoMargin:(char == $h) "DECAWM"].
^ #sequenceComplete
].
+ (char == $n) ifTrue: [
+ "/ (parameters at: 1) = 15 ifTrue: [ ... ]. -- What is the printer status?
+ "/ (parameters at: 1) = 25 ifTrue: [ ... ]. -- Are user-defined keys locked or unlocked?
+ "/ (parameters at: 1) = 26 ifTrue: [ ... ]. -- What is the keyboard language?
+ ].
^ #unknown
!
processStateGotCSI3:char
-" change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
TraceCSI == true ifTrue:[ self traceCSI:char ].
^ #unknown
!
processStateGotCSI:char
-" change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
char == $? ifTrue: [
state := #gotCSI2.
@@ -1129,11 +1140,13 @@
!
processStateGotESC:char
-" change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
char == $[ ifTrue: [
"/ ESC-[
@@ -1213,11 +1226,13 @@
!
processStateGotReturn:char
-" change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
state := 0.
char == Character nl ifTrue:[
@@ -1238,11 +1253,13 @@
!
processStateGotXTERMCSI2:char
-" change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
char == (Character value:7) ifTrue: [
TraceCSI == true ifTrue:[ self traceCSI:char ].
@@ -1256,11 +1273,13 @@
!
processStateGotXTERMCSI:char
-" change state or processing character; return
- #waitForNextChar - state was changed and wait for next characters
- #sequenceComplete - command processed
- #unknown - unknown character for this state
-"
+ "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
+ "
char == $; ifTrue:[
currentParam := (currentParam + 1) min: 8.