TerminalView.st
changeset 5234 a63a39bc4b18
parent 5231 9637e8584b30
child 5235 59dff2af4d54
child 5236 cd1625cfd882
equal deleted inserted replaced
5233:011a234e6095 5234:a63a39bc4b18
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 1998 by eXept Software AG
     2  COPYRIGHT (c) 1998 by eXept Software AG
     5               All Rights Reserved
     3               All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
  1114             lineBufferHistory := OrderedCollection new.
  1112             lineBufferHistory := OrderedCollection new.
  1115         ].
  1113         ].
  1116         (lineBufferHistory size > 0 and:[lineBufferHistory last isEmpty]) ifTrue:[
  1114         (lineBufferHistory size > 0 and:[lineBufferHistory last isEmpty]) ifTrue:[
  1117             lineBufferHistory removeLast
  1115             lineBufferHistory removeLast
  1118         ].
  1116         ].
  1119         "/ do not remember repetitions
  1117         "/ do not remember blank lines
  1120         (lineBufferHistory size > 0 and:[lineBufferHistory last = lineBuffer]) ifTrue:[
  1118         (lineBuffer notEmptyOrNil and:[lineBuffer isBlank not]) ifTrue:[
  1121         ] ifFalse:[
  1119             "/ do not remember repetitions
  1122             lineBufferHistory addLast:lineBuffer.
  1120             (lineBufferHistory size > 0 and:[lineBufferHistory last = lineBuffer]) ifTrue:[
  1123         ].
  1121             ] ifFalse:[
  1124         lineBufferHistoryPosition := lineBufferHistory size + 1.
  1122                 lineBufferHistory addLast:lineBuffer.
  1125         lineBuffer := nil.
       
  1126 
       
  1127         maxHistorySize notNil ifTrue:[
       
  1128             [ lineBufferHistory size > maxHistorySize] whileTrue:[
       
  1129                 lineBufferHistory removeFirst.
       
  1130             ].
  1123             ].
  1131         ].
  1124             lineBufferHistoryPosition := lineBufferHistory size + 1.
  1132 
  1125             lineBuffer := nil.
       
  1126 
       
  1127             maxHistorySize notNil ifTrue:[
       
  1128                 [ lineBufferHistory size > maxHistorySize] whileTrue:[
       
  1129                     lineBufferHistory removeFirst.
       
  1130                 ].
       
  1131             ].
       
  1132         ].
  1133         ^ true.
  1133         ^ true.
  1134     ].
  1134     ].
  1135 
  1135 
  1136     aKey == #BackSpace ifTrue:[
  1136     aKey == #BackSpace ifTrue:[
  1137         lineBufferCursorPosition > 1 ifFalse:[
  1137         lineBufferCursorPosition > 1 ifFalse:[
  1180     aKey == #CursorUp ifTrue:[
  1180     aKey == #CursorUp ifTrue:[
  1181         (lineBufferHistoryPosition notNil and:[lineBufferHistoryPosition > 1]) ifFalse:[
  1181         (lineBufferHistoryPosition notNil and:[lineBufferHistoryPosition > 1]) ifFalse:[
  1182             self beep.
  1182             self beep.
  1183             ^ true
  1183             ^ true
  1184         ].
  1184         ].
  1185 
  1185     
  1186         "/ remember the current lineBuffer (but only if it is the last)
  1186         "/ remember the current lineBuffer (but only if it is the last)
  1187         lineBufferHistoryPosition > lineBufferHistory size ifTrue:[
  1187         lineBufferHistoryPosition > lineBufferHistory size ifTrue:[
  1188             lineBufferHistory add:lineBuffer.
  1188             (lineBuffer notEmptyOrNil and:[lineBuffer isBlank not]) ifTrue:[  
       
  1189                 lineBufferHistory add:lineBuffer.
       
  1190             ].
  1189         ].
  1191         ].
  1190         clearLine value.
  1192         clearLine value.
  1191 
  1193 
  1192         (self sensor shiftDown and:[lastSelectedLineBufferHistoryPosition notNil]) ifTrue:[
  1194         (self sensor shiftDown and:[lastSelectedLineBufferHistoryPosition notNil]) ifTrue:[
  1193             lineBufferHistoryPosition := lastSelectedLineBufferHistoryPosition.
  1195             lineBufferHistoryPosition := lastSelectedLineBufferHistoryPosition.