st80 behavior: also scan for matching single quote
authorClaus Gittinger <cg@exept.de>
Tue, 22 Apr 2008 17:43:19 +0200
changeset 3588 a70267e5b501
parent 3587 8685721a709f
child 3589 2d6c6b29935d
st80 behavior: also scan for matching single quote
TextView.st
--- a/TextView.st	Tue Apr 22 17:32:15 2008 +0200
+++ b/TextView.st	Tue Apr 22 17:43:19 2008 +0200
@@ -1269,11 +1269,12 @@
 doubleClickX:x y:y
     "double-click - select word under pointer"
 
-    |sel ch matchCol scanCol fwdScan fwdSelect|
+    |sel ch scanCh matchCol scanCol fwdScan fwdSelect|
 
     (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
         "/ st80 selects:
         "/   if clicked right after a parenthesis -> select to matching parenthesis
+        "/   if clicked right after a quote -> select to matching quote (unless escaped ;-)
         "/   if clicked at beginning of the line  -> select that line
         "/   if clicked at the top of the text    -> select all
         "/
@@ -1291,25 +1292,27 @@
         "/ see what is to the left of that character ...
         clickCol > 1 ifTrue:[
             ch := self characterAtLine:clickLine col:clickCol-1.
-            ('([{<' includes:ch) ifTrue:[
+            ('([{<|' includes:ch) ifTrue:[
                 matchCol := clickCol - 1
             ] ifFalse:[
-                ('"' includes:ch) ifTrue:[
+                ('"''' includes:ch) ifTrue:[
                     scanCol := clickCol - 1.
-                    fwdScan := true
+                    fwdScan := true.
+                    scanCh := ch.    
                 ]
             ]
         ].
         fwdSelect := true.
         clickCol < (self listAt:clickLine) size ifTrue:[
             ch := self characterAtLine:clickLine col:clickCol+1.
-            (')]}>' includes:ch) ifTrue:[
+            (')]}>|' includes:ch) ifTrue:[
                 matchCol := clickCol + 1.
                 fwdSelect := false.
             ] ifFalse:[
-                ('"' includes:ch) ifTrue:[
+                ('"''' includes:ch) ifTrue:[
                     scanCol := clickCol + 1.
-                    fwdScan := false
+                    fwdScan := false.
+                    scanCh := ch.    
                 ]
             ]
         ].
@@ -1332,7 +1335,7 @@
             ].
 
             self 
-                scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan
+                scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
                 ifFound:[:line :col |
                             |selStart selEnd|
 
@@ -4067,7 +4070,7 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.285 2008-04-22 15:32:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.286 2008-04-22 15:43:19 cg Exp $'
 ! !
 
 TextView initialize!