--- a/TerminalView.st Mon Jul 27 13:48:19 1998 +0200
+++ b/TerminalView.st Mon Jul 27 14:01:26 1998 +0200
@@ -987,91 +987,115 @@
self hideCursor.
-access critical:[
- |i i2 s crnlFollows|
+ "/ the following may not be too clean, but adds a lot of speed.
+ "/ instead of passing every individual character through the
+ "/ escape-state machine, collect chunks of non-control text
+ "/ when in state 0, and add them immediately to the pendingLines
+ "/ collection of the textCollectors asynchronous update mechanism.
+ "/ This helps a lot if you do something like "ls -lR /" ...
+ "/ For debugging the state machine, reenable the commented lines
+ "/ below.
+
+"/1 to:count do:[:i|
+"/ self nextPut:(buffer at:i).
+"/].
+"/self showCursor.
+"/^ self.
+
+ access critical:[
+ |i i2 s crnlFollows|
- i := 1.
- [i <= count] whileTrue:[
- (state == 0) ifTrue:[
- "/ in initial state.
- "/ quick scan forward for next control character ...
- i2 := buffer indexOfControlCharacterStartingAt:i.
- i2 == 0 ifTrue:[
- "/ no control characters - simply append all
- "/ to the outstanding lines ...
- s := buffer copyFrom:i to:count.
- i := count + 1. "/ leave loop.
- crnlFollows := false.
- ] ifFalse:[
- i2 > i ifTrue:[
- s := buffer copyFrom:i to:i2-1.
- i := i2. "/ proceed withcontrol character
+ i := 1.
+ [i <= count] whileTrue:[
+ (state == 0) ifTrue:[
+ "/ in initial state.
+ "/ quick scan forward for next control character ...
+ i2 := buffer indexOfControlCharacterStartingAt:i.
+ i2 == 0 ifTrue:[
+ "/ no control characters - simply append all
+ "/ to the outstanding lines ...
+ s := buffer copyFrom:i to:count.
+ i := count + 1. "/ leave loop.
crnlFollows := false.
- i < (count - 1) ifTrue:[
- (buffer at:i) == Character return ifTrue:[
- (buffer at:i+1) == Character nl ifTrue:[
- crnlFollows := true.
- i := i + 2.
+ ] ifFalse:[
+ i2 > i ifTrue:[
+ s := buffer copyFrom:i to:i2-1.
+ i := i2. "/ proceed withcontrol character
+ crnlFollows := false.
+ i < (count - 1) ifTrue:[
+ (buffer at:i) == Character return ifTrue:[
+ (buffer at:i+1) == Character nl ifTrue:[
+ crnlFollows := true.
+ i := i + 2.
+ ]
]
- ]
- ].
- ]
- ].
- ].
-
- s notNil ifTrue:[
- currentEmphasis notNil ifTrue:[
- s := s emphasizeAllWith:currentEmphasis
+ ].
+ ]
+ ].
].
- outstandingLine size > 0 ifTrue:[
- outstandingLine := outstandingLine , s.
- ] ifFalse:[
- outstandingLine := s.
- ].
- crnlFollows ifTrue:[
- outstandingLines isNil ifTrue:[
- outstandingLines := OrderedCollection with:outstandingLine
+ s notNil ifTrue:[
+ currentEmphasis notNil ifTrue:[
+ s := s emphasizeAllWith:currentEmphasis
+ ].
+
+ outstandingLine size > 0 ifTrue:[
+ outstandingLine := outstandingLine , s.
] ifFalse:[
- outstandingLines add:outstandingLine.
+ outstandingLine := s.
].
- outstandingLine := ''.
- ].
- s := nil.
+ crnlFollows ifTrue:[
+ outstandingLines isNil ifTrue:[
+ outstandingLines := OrderedCollection with:outstandingLine
+ ] ifFalse:[
+ outstandingLines add:outstandingLine.
+ ].
+ outstandingLine := ''.
+ ].
+ s := nil.
- collecting ifTrue:[
- flushPending ifFalse:[
- self installDelayedUpdate
- ] ifTrue:[
-"/ outstandingLines size > collectSize ifTrue:[
-"/ self endEntry
-"/ ]
- ]
+ collecting ifTrue:[
+ flushPending ifFalse:[
+ self installDelayedUpdate
+ ] ifTrue:[
+ "/ outstandingLines size > collectSize ifTrue:[
+ "/ self endEntry
+ "/ ]
+ ]
+ ] ifFalse:[
+ self endEntry
+ ].
] ifFalse:[
- self endEntry
- ].
- ] ifFalse:[
- "/ no chunk to append (in an escape sequence)
- "/ must handle individual characters
- "/ to update the state machine.
- self nextPut:(buffer at:i).
- i := i + 1.
- ]
+ "/ no chunk to append (in an escape sequence)
+ "/ must handle individual characters
+ "/ to update the state machine.
+ self nextPut:(buffer at:i).
+ i := i + 1.
+ ]
+ ].
+
].
-].
+ (sensor := self sensor) notNil ifTrue:[
+ "/ if there is no more output pending from the shell,
+ "/ enforce update of the view (asynchronous)
- (sensor := self sensor) notNil ifTrue:[
(sensor hasEvent:#processInput:n: for:self) ifFalse:[
self endEntry.
self showCursor.
"/ self makeCursorVisible.
] ifTrue:[
+ "/ if there is more output pending from the shell,
+ "/ and many lines have already been collected,
+ "/ also enforce update of the view (asynchronous)
+ "/ Thus, it will update at least once for every
+ "/ collectSize lines.
+
outstandingLines size > collectSize ifTrue:[
self endEntry.
self showCursor.
- "/ self makeCursorVisible.
- "/ redraw
+
+ "/ make certain that things are really displayed ...
windowGroup notNil ifTrue:[
windowGroup processRealExposeEventsFor:self.
]
@@ -1080,7 +1104,7 @@
].
"Created: / 10.6.1998 / 17:26:09 / cg"
- "Modified: / 21.7.1998 / 19:30:18 / cg"
+ "Modified: / 27.7.1998 / 14:01:02 / cg"
! !
!TerminalView methodsFor:'queries'!
@@ -1132,5 +1156,5 @@
!TerminalView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.52 1998-07-27 11:48:19 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.53 1998-07-27 12:01:26 cg Exp $'
! !