--- a/EditTextView.st Mon Aug 07 09:27:58 2017 +0100
+++ b/EditTextView.st Wed Oct 11 23:37:38 2017 +0100
@@ -536,6 +536,14 @@
Standard: Selection is extended to include a space (first press) and a word right to previously selected one
(checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
+* Indenting selected block with Tab
+ Scenario:
+ 1. Select a block (i.e, make selection that pans multiple lines)
+ 2. Press Tab
+
+ Traditional St/X: A single 'tab' is inserted
+ Standard: all lines in the selection are indented.
+
"
! !
@@ -5511,8 +5519,7 @@
#OpenSpecialCharacterWindow #InsertUUID
#'F*' #'f*')>
- |fKeyMacros shiftPressed ctrlPressed i event macroName
- immediateCompletion currentUserPrefs rawKey|
+ |fKeyMacros shiftPressed ctrlPressed i event immediateCompletion currentUserPrefs rawKey|
currentUserPrefs := UserPreferences current.
@@ -5850,18 +5857,13 @@
].
((key == #BackTab) or:[(key == #Tab)]) ifTrue:[
self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y].
-
- self hasSelection ifTrue:[
- selectStyle == #line ifTrue:[
- ((key == #Tab) and:[shiftPressed not]) ifTrue:[
- macroName := #IndentBy4.
- ] ifFalse:[
- macroName := #UndentBy4.
- ].
- macroName notNil ifTrue:[
- self executekeyboardMacroNamed:macroName.
- ].
- ]
+ (self hasSelection and:[selectionStartLine ~~ selectionEndLine]) ifTrue:[
+ ((key == #Tab) and:[shiftPressed not]) ifTrue:[
+ self indentByTab.
+ ] ifFalse:[
+ self undentByTab.
+ ].
+ ^ self.
].
self unselect.
@@ -5958,7 +5960,7 @@
"Modified: / 06-02-1998 / 11:59:59 / stefan"
"Modified: / 14-07-2011 / 12:08:28 / cg"
- "Modified: / 31-03-2014 / 16:27:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-10-2017 / 23:08:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
executeKeyboardMacro:cmdMacro
@@ -6438,12 +6440,20 @@
]
]
].
+ "/ Update the selection, if not whole-lines...
+ (selectionStartLine == start and:[ selectionStartCol ~~ 1]) ifTrue:[
+ selectionStartCol := (selectionStartCol + delta) max: 1.
+ ].
+ (selectionEndLine == end and:[ selectionEndCol ~~ 0]) ifTrue:[
+ selectionEndCol := (selectionEndCol + delta) max: 1.
+ ].
anyChange ifTrue:[ self textChanged ].
"/ self redrawFromLine:start to:end
- "Modified: 5.3.1996 / 14:59:18 / cg"
+ "Modified: / 05-03-1996 / 14:59:18 / cg"
+ "Modified: / 11-10-2017 / 23:22:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
leftIndentForLine:lineNr