--- a/TerminalView.st Thu Aug 20 15:27:05 2015 +0200
+++ b/TerminalView.st Fri Aug 21 14:16:45 2015 +0200
@@ -24,7 +24,8 @@
alternateKeypadMode noColors sizeOfOutstandingInputToBeProcessed
lineEditMode lineBuffer lineBufferCursorPosition
lineBufferHistory lineBufferHistoryPosition maxHistorySize doUTF
- ignoreOutput sendControlKeys'
+ ignoreOutput sendControlKeys
+ lastSelectedLineBufferHistoryPosition'
classVariableNames:'Debug DebugKeyboard DefaultMaxHistorySize'
poolDictionaries:''
category:'Views-TerminalViews'
@@ -894,7 +895,10 @@
keyPressInLineEditMode:aKey
"readline alike line editing.
- return true, if the character was processed,
+ cursorUp/down select a previous line from the history (unix shell bahevior).
+ shift cursorUp selects a previous selected history line from the history (windows shell bahevior).
+ cursor left/right/backspace edit inside that line.
+ Return true, if the character was processed,
false if not. Then, the caller should proceed as usual."
|clearLine|
@@ -928,6 +932,8 @@
clearLine value.
self sendCR:lineBuffer.
+ lastSelectedLineBufferHistoryPosition := lineBufferHistoryPosition.
+
lineBufferHistory isNil ifTrue:[
lineBufferHistory := OrderedCollection new.
].
@@ -993,7 +999,12 @@
].
clearLine value.
- lineBufferHistoryPosition := lineBufferHistoryPosition - 1.
+ (self sensor shiftDown and:[lastSelectedLineBufferHistoryPosition notNil]) ifTrue:[
+ lineBufferHistoryPosition := lastSelectedLineBufferHistoryPosition.
+ ] ifFalse:[
+ lineBufferHistoryPosition := lineBufferHistoryPosition - 1.
+ ].
+ "/ lastSelectedLineBufferHistoryPosition := lineBufferHistoryPosition.
lineBuffer := lineBufferHistory at:lineBufferHistoryPosition.
self insertStringAtCursor:lineBuffer.
lineBufferCursorPosition := lineBuffer size + 1.
@@ -1008,6 +1019,7 @@
clearLine value.
lineBufferHistoryPosition := lineBufferHistoryPosition + 1.
+ "/ lastSelectedLineBufferHistoryPosition := lineBufferHistoryPosition.
lineBuffer := lineBufferHistory at:lineBufferHistoryPosition.
lineBufferHistoryPosition >= lineBufferHistory size ifTrue:[
lineBufferHistory removeLast.