TextView.st
changeset 6351 31f344d402c3
parent 6343 38dfd16a2888
child 6358 c260ba065216
--- a/TextView.st	Fri Jun 15 12:26:22 2018 +0200
+++ b/TextView.st	Fri Jun 15 13:56:40 2018 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -1734,7 +1732,8 @@
 !
 
 extendSelectionToX:x y:y setPrimarySelection:aBoolean
-    "mouse-move while button was pressed - handle selection changes"
+    "mouse-move while button was pressed or shift-clicked  
+     - handle selection changes"
 
     |movedVisibleLine movedLine movedCol
      movedUp
@@ -1806,17 +1805,23 @@
     ].
 
     movedUp ifTrue:[
-        "change selectionStart"
+        "select backwards"
         selectionStartCol := movedCol.
         selectionStartLine := movedLine.
-        selectionEndCol := clickStartCol.
+        "/ with shift-click, take char before cursor pos
+        "/ with button motion, take char at cursor pos
+        self sensor shiftDown ifTrue:[
+            selectionEndCol := clickStartCol-1.
+        ] ifFalse:[
+            selectionEndCol := clickStartCol.
+        ].    
         selectionEndLine := clickStartLine.
         selectStyle notNil ifTrue:[
             selectionEndCol := wordEndCol.
             selectionEndLine := wordEndLine.
         ]
     ] ifFalse:[
-        "change selectionEnd"
+        "self forward"
         selectionEndCol := movedCol.
         selectionEndLine := movedLine.
         selectionStartCol := clickStartCol.
@@ -1900,6 +1905,7 @@
 
     "Modified: / 05-04-2011 / 17:13:35 / cg"
     "Modified: / 17-04-2012 / 21:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 15-06-2018 / 13:55:19 / Claus Gittinger"
 !
 
 keyPress:key x:x y:y