fixed st80 doubleclick behavior, when clicking beside a parenthesis.
authorClaus Gittinger <cg@exept.de>
Mon, 17 Jul 2006 12:58:13 +0200
changeset 3316 1ef036eee59f
parent 3315 1b42d2f8dcbc
child 3317 1a45a2a1a47c
fixed st80 doubleclick behavior, when clicking beside a parenthesis.
TextView.st
--- a/TextView.st	Wed Jul 05 11:57:02 2006 +0200
+++ b/TextView.st	Mon Jul 17 12:58:13 2006 +0200
@@ -1224,7 +1224,7 @@
 doubleClickX:x y:y
     "double-click - select word under pointer"
 
-    |sel ch matchCol scanCol fwdScan|
+    |sel ch matchCol scanCol fwdScan fwdSelect|
 
     self class st80SelectMode ifTrue:[
         "/ st80 selects:
@@ -1255,10 +1255,12 @@
                 ]
             ]
         ].
+        fwdSelect := true.
         clickCol < (self listAt:clickLine) size ifTrue:[
             ch := self characterAtLine:clickLine col:clickCol+1.
             (')]}>' includes:ch) ifTrue:[
                 matchCol := clickCol + 1.
+                fwdSelect := false.
             ] ifFalse:[
                 ('"' includes:ch) ifTrue:[
                     scanCol := clickCol + 1.
@@ -1267,7 +1269,13 @@
             ]
         ].
         matchCol notNil ifTrue:[
-            self searchForAndSelectMatchingParenthesisFromLine:clickLine col:matchCol.
+            self 
+                searchForMatchingParenthesisFromLine:clickLine col:matchCol
+                ifFound:[:line :col | 
+                          self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
+                                       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
+                ifNotFound:[self showNotFound]
+                onError:[self beep].
             ^ self
         ].
         scanCol notNil ifTrue:[
@@ -1380,7 +1388,7 @@
     ]
 
     "Created: / 11-09-1997 / 04:12:55 / cg"
-    "Modified: / 03-07-2006 / 16:28:08 / cg"
+    "Modified: / 16-07-2006 / 12:04:51 / cg"
 !
 
 extendSelectionToX:x y:y
@@ -3882,7 +3890,7 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.268 2006-07-05 09:57:02 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.269 2006-07-17 10:58:13 cg Exp $'
 ! !
 
 TextView initialize!