--- a/EditTextView.st Wed Mar 15 19:37:36 2017 +0100
+++ b/EditTextView.st Sun Mar 19 10:10:56 2017 +0100
@@ -5214,152 +5214,153 @@
self changeTypeOfSelectionTo:nil.
(key == #CursorRight) ifTrue:[
- (shifted and:[selectionStartLine isNil]) ifTrue:[
- selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
- selectionStartCol := selectionEndCol := clickStartCol := cursorCol.
- expandingTop := false.
- self validateNewSelection.
- self setPrimarySelection.
- self selectionChanged.
- self redrawLine:selectionStartLine.
- ^ self.
- ].
-
- selectionStartLine notNil ifTrue:[
- self cursorMovementAllowed ifTrue:[
- "/
- "/ treat the whole selection as cursor
- "/
- self setCursorLine:(selectionEndLine ? selectionStartLine).
- selectionEndCol == 0 ifTrue:[
- selectionEndCol := 1.
- ].
- self setCursorCol:selectionEndCol.
- shifted ifTrue:[
- self expandSelectionRight.
- ^ self
- ].
- self unselect; makeCursorVisible.
- cursorCol == 1 ifTrue:[^ self].
- ].
- ].
- self cursorRight.
- ^ self
+ (shifted and:[selectionStartLine isNil]) ifTrue:[
+ selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
+ selectionStartCol := selectionEndCol := clickStartCol := cursorCol.
+ expandingTop := false.
+ self validateNewSelection.
+ self setPrimarySelection.
+ self selectionChanged.
+ self redrawLine:selectionStartLine.
+ ^ self.
+ ].
+
+ selectionStartLine notNil ifTrue:[
+ self cursorMovementAllowed ifTrue:[
+ "/
+ "/ treat the whole selection as cursor
+ "/
+ self setCursorLine:(selectionEndLine ? selectionStartLine).
+ selectionEndCol == 0 ifTrue:[
+ selectionEndCol := 1.
+ ].
+ self setCursorCol:selectionEndCol.
+ shifted ifTrue:[
+ self expandSelectionRight.
+ ^ self
+ ].
+ self unselect; makeCursorVisible.
+ "/ cursorCol == 1 ifTrue:[^ self].
+ ].
+ ].
+ self cursorRight.
+ ^ self
].
(key == #CursorDown) ifTrue:[
- (shifted and:[selectionStartLine isNil]) ifTrue:[
- selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1.
- selectionStartCol := clickStartCol := selectionEndCol := cursorCol.
- selectionEndCol == 1 ifTrue:[
- selectionEndCol := 0.
- ].
- self validateNewSelection.
- self selectionChanged.
- self redrawLine:selectionStartLine.
- expandingTop := false.
- self redrawLine:selectionEndLine.
- ^ self
- ].
-
- selectionStartLine notNil ifTrue:[
- self cursorMovementAllowed ifTrue:[
- "/
- "/ treat the whole selection as cursor
- "/
- self setCursorLine:(selectionEndLine ? selectionStartLine).
- self setCursorCol:selectionStartCol.
- (cursorCol == 0 or:[selectionEndCol == 0]) ifTrue:[
- self setCursorCol:1.
- self setCursorLine:(cursorLine - 1).
- ].
- self makeCursorVisible.
-
- shifted ifTrue:[
- clickLine := cursorLine.
- clickCol := cursorCol.
- self expandSelectionDown.
- ^ self
- ].
- self unselect.
- ].
- ].
-
- n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown).
- self cursorDown:n.
- "/
- "/ flush keyboard to avoid runaway cursor
- "/
- self sensor flushKeyboardFor:self.
- ^ self
+ (shifted and:[selectionStartLine isNil]) ifTrue:[
+ selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1.
+ selectionStartCol := clickStartCol := selectionEndCol := cursorCol.
+ selectionEndCol == 1 ifTrue:[
+ selectionEndCol := 0.
+ ].
+ self validateNewSelection.
+ self selectionChanged.
+ self redrawLine:selectionStartLine.
+ expandingTop := false.
+ self redrawLine:selectionEndLine.
+ ^ self
+ ].
+
+ selectionStartLine notNil ifTrue:[
+ self cursorMovementAllowed ifTrue:[
+ "/
+ "/ treat the whole selection as cursor
+ "/
+ self setCursorLine:(selectionEndLine ? selectionStartLine).
+ self setCursorCol:selectionStartCol.
+ (cursorCol == 0 or:[selectionEndCol == 0]) ifTrue:[
+ self setCursorCol:1.
+ self setCursorLine:(cursorLine - 1).
+ ].
+ self makeCursorVisible.
+
+ shifted ifTrue:[
+ clickLine := cursorLine.
+ clickCol := cursorCol.
+ self expandSelectionDown.
+ ^ self
+ ].
+ self unselect.
+ ].
+ ].
+
+ n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown).
+ self cursorDown:n.
+ "/
+ "/ flush keyboard to avoid runaway cursor
+ "/
+ self sensor flushKeyboardFor:self.
+ ^ self
].
(key == #CursorLeft or:[key == #CursorUp]) ifTrue:[
- (shifted and:[selectionStartLine isNil]) ifTrue:[
- expandingTop := true.
- key == #CursorLeft ifTrue:[
- cursorCol > 1 ifTrue:[
- selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
- selectionEndCol := clickStartCol := cursorCol-1.
- selectionStartCol := cursorCol-1.
- self validateNewSelection.
- self selectionChanged.
- self redrawLine:selectionStartLine.
- ^ self
- ]
- ] ifFalse:[
- cursorLine > 1 ifTrue:[
- selectionEndLine := clickStartLine := cursorLine.
- selectionEndCol := selectionStartCol := clickStartCol := cursorCol.
- selectionStartLine := cursorLine - 1.
- selectionEndCol == 1 ifTrue:[
- selectionEndCol := 0.
- ].
- self validateNewSelection.
- self selectionChanged.
- self redrawFromLine:selectionStartLine to:cursorLine.
- ^ self
- ]
- ]
- ].
-
- selectionStartLine notNil ifTrue:[
- self cursorMovementAllowed ifTrue:[
- "/
- "/ treat the whole selection as cursor
- "/
- self setCursorLine:selectionStartLine.
- self setCursorCol:selectionStartCol.
- (key == #CursorLeft) ifTrue:[
- self setCursorCol:(cursorCol+1). "/ compensate for followup crsr-left
- ].
- self makeCursorVisible.
-
- shifted ifTrue:[
- (key == #CursorUp) ifTrue:[
- clickLine := cursorLine.
- self expandSelectionUp.
- ] ifFalse:[
- self expandSelectionLeft.
- ].
- ^ self
- ].
- self unselect.
- ].
- ].
- (key == #CursorLeft) ifTrue:[
- self cursorLeft. ^self
- ].
- (key == #CursorUp) ifTrue:[
- n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp).
- self cursorUp:n.
- "/
- "/ flush keyboard to avoid runaway cursor
- "/
- self sensor flushKeyboardFor:self.
- ^ self
- ].
+ (shifted and:[selectionStartLine isNil]) ifTrue:[
+ expandingTop := true.
+ key == #CursorLeft ifTrue:[
+ cursorCol > 1 ifTrue:[
+ selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
+ selectionEndCol := clickStartCol := cursorCol-1.
+ selectionStartCol := cursorCol-1.
+ self validateNewSelection.
+ self selectionChanged.
+ self redrawLine:selectionStartLine.
+ ^ self
+ ]
+ ] ifFalse:[
+ cursorLine > 1 ifTrue:[
+ selectionEndLine := clickStartLine := cursorLine.
+ selectionEndCol := selectionStartCol := clickStartCol := cursorCol.
+ selectionStartLine := cursorLine - 1.
+ selectionEndCol == 1 ifTrue:[
+ selectionEndCol := 0.
+ ].
+ self validateNewSelection.
+ self selectionChanged.
+ self redrawFromLine:selectionStartLine to:cursorLine.
+ ^ self
+ ]
+ ]
+ ].
+
+ selectionStartLine notNil ifTrue:[
+ self cursorMovementAllowed ifTrue:[
+ "/
+ "/ treat the whole selection as cursor
+ "/
+ self setCursorLine:selectionStartLine.
+ self setCursorCol:selectionStartCol.
+ (key == #CursorLeft) ifTrue:[
+ self setCursorCol:(cursorCol+1). "/ compensate for followup crsr-left
+ ].
+ self makeCursorVisible.
+
+ shifted ifTrue:[
+ (key == #CursorUp) ifTrue:[
+ clickLine := cursorLine.
+ self expandSelectionUp.
+ ] ifFalse:[
+ self expandSelectionLeft.
+ ].
+ ^ self
+ ].
+ self unselect.
+ ].
+ ].
+ (key == #CursorLeft) ifTrue:[
+ self cursorLeft. ^self
+ ].
+ (key == #CursorUp) ifTrue:[
+ n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp).
+ self cursorUp:n.
+ "/
+ "/ flush keyboard to avoid runaway cursor
+ "/
+ self sensor flushKeyboardFor:self.
+ ^ self
+ ].
].
"Modified: / 17-04-2012 / 21:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-03-2017 / 10:08:54 / cg"
!
doKeyPress:key x:x y:y