diff -r d0e0234d922c -r 0eb26aed1456 EditTextView.st --- a/EditTextView.st Fri Mar 28 12:42:44 2014 +0000 +++ b/EditTextView.st Mon Mar 31 16:29:30 2014 +0200 @@ -138,69 +138,6 @@ !EditTextView class methodsFor:'documentation'! -selection_and_cursor_movement -" -Changes done to implement 'standard' behaviour (that's how vast majority of widgets used in todays desktops behaves) -as opposed to 'traditional' which is what how it was in St/X 'ever since' - -* Numerous off-by-one bugs - -* Extending selection by dragging: - Scenario: - 1. Select & drag to expand beggining of the selection (i.e., drag from 'end' to 'beggining' - 2. Stop dragging - 3. Press Shift-Left / Shift-Right (to refine selection) - - Traditional ST/X: end of selection is moved - Standard: beginning of selection is moved - (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) - -* Extending selection by Shift-Home / Shift-End - Scenario: - 1. Position cursor in the middle of the line - 2. Press Shift-Home (line for beginning should be selected) - 3. Press Shift-Right (to refine selection) - - Traditional ST/X: end of selection is moved - Standard: beginning of selection is moved - (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) - -* Selection flip by Shift-Home / Shift-End - Scenario A: - 1. Position cursor in the middle of the line to column C - 2. Press Shift-Home (line from beginning should be selected) - 2. Press Shift-End - - Traditional ST/X: end of selection is moved so whole line is selected - Standard: Selection 'flips' so part of line from column C to the end is selected - (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) - - Scenario B: - 1. Position cursor in the middle of the line to column C - 2. Press Shift-End (column C to the end of line should be selected) - 2. Press Shift-Home - - Traditional ST/X: beginning of selection is moved so whole line is selected - Standard: Selection 'flips' so part of line from the beginning to column C is selected - (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) - - NOTE: This could be controlled by - UserPreferences current selectionExtensionMode - - -* Extending selection with Ctrl-Shift-Left / Ctrl-Shift-Right - Scenario A: - 1. Position cursor in the middle of the line to column C - 2. Select word - 3. Press Ctrl-Shift-Right, Ctrl-Shift-Right - - Traditional ST/X: nothing happens at all - 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) - -" -! - copyright " COPYRIGHT (c) 1989 by Claus Gittinger @@ -526,6 +463,69 @@ top2 open. [exEnd] " +! + +selection_and_cursor_movement +" +Changes done to implement 'standard' behaviour (that's how vast majority of widgets used in todays desktops behaves) +as opposed to 'traditional' which is what how it was in St/X 'ever since' + +* Numerous off-by-one bugs + +* Extending selection by dragging: + Scenario: + 1. Select & drag to expand beggining of the selection (i.e., drag from 'end' to 'beggining' + 2. Stop dragging + 3. Press Shift-Left / Shift-Right (to refine selection) + + Traditional ST/X: end of selection is moved + Standard: beginning of selection is moved + (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) + +* Extending selection by Shift-Home / Shift-End + Scenario: + 1. Position cursor in the middle of the line + 2. Press Shift-Home (line for beginning should be selected) + 3. Press Shift-Right (to refine selection) + + Traditional ST/X: end of selection is moved + Standard: beginning of selection is moved + (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) + +* Selection flip by Shift-Home / Shift-End + Scenario A: + 1. Position cursor in the middle of the line to column C + 2. Press Shift-Home (line from beginning should be selected) + 2. Press Shift-End + + Traditional ST/X: end of selection is moved so whole line is selected + Standard: Selection 'flips' so part of line from column C to the end is selected + (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) + + Scenario B: + 1. Position cursor in the middle of the line to column C + 2. Press Shift-End (column C to the end of line should be selected) + 2. Press Shift-Home + + Traditional ST/X: beginning of selection is moved so whole line is selected + Standard: Selection 'flips' so part of line from the beginning to column C is selected + (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox) + + NOTE: This could be controlled by + UserPreferences current selectionExtensionMode + + +* Extending selection with Ctrl-Shift-Left / Ctrl-Shift-Right + Scenario A: + 1. Position cursor in the middle of the line to column C + 2. Select word + 3. Press Ctrl-Shift-Right, Ctrl-Shift-Right + + Traditional ST/X: nothing happens at all + 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) + +" ! ! !EditTextView class methodsFor:'defaults'! @@ -5166,9 +5166,27 @@ ]. ^ self ]. - (key == #NextWord) ifTrue:[self cursorToNextWord. ^self]. + (key == #NextWord) ifTrue:[ + shiftPressed ifTrue:[ + self addToSelectionAfter:[ + self cursorToNextWord. + ] + ] ifFalse:[ + self cursorToNextWord + ]. + ^self + ]. (key == #EndOfWord) ifTrue:[self cursorToEndOfWord. ^self]. - (key == #PreviousWord) ifTrue:[self cursorToPreviousWord. ^self]. + (key == #PreviousWord) ifTrue:[ + shiftPressed ifTrue:[ + self addToSelectionAfter:[ + self cursorToPreviousWord. + ] + ] ifFalse:[ + self cursorToPreviousWord. + ]. + ^self + ]. (key == #GotoLine) ifTrue:[self gotoLine. ^self]. (key == #CursorRight @@ -5363,7 +5381,7 @@ "Modified: / 06-02-1998 / 11:59:59 / stefan" "Modified: / 14-07-2011 / 12:08:28 / cg" - "Modified: / 26-09-2013 / 17:52:04 / Jan Vrany " + "Modified: / 31-03-2014 / 16:27:08 / Jan Vrany " ! executeKeyboardMacro:cmdMacro