TextView.st
changeset 1851 edec458ccfb4
parent 1841 0c281de3baa7
child 1893 bce50b364466
--- a/TextView.st	Wed Apr 21 12:33:52 1999 +0200
+++ b/TextView.st	Wed Apr 21 12:34:56 1999 +0200
@@ -892,78 +892,82 @@
     |sel ch matchCol scanCol fwdScan|
 
     ST80Selections == true ifTrue:[
-	"/ st80 selects:
-	"/   if clicked right after a parenthesis -> select to matching parenthesis
-	"/   if clicked at beginning of the line  -> select that line
-	"/   if clicked at the top of the text    -> select all
-	"/
-	clickCol == 1 ifTrue:[
-	    clickLine == 1 ifTrue:[
-		self selectAll.
-		^ self.
-	    ].
-	    self selectLineAtY:y.
-	    selectStyle := #line.
-	    ^ self
-	].
-
-	matchCol := nil.
-	"/ see what is to the left of that character ...
-	clickCol > 1 ifTrue:[
-	    ch := self characterAtLine:clickLine col:clickCol-1.
-	    ('([{<' includes:ch) ifTrue:[
-		matchCol := clickCol - 1
-	    ] ifFalse:[
-		('"' includes:ch) ifTrue:[
-		    scanCol := clickCol - 1.
-		    fwdScan := true
-		]
-	    ]
-	].
-	clickCol < (self listAt:clickLine) size ifTrue:[
-	    ch := self characterAtLine:clickLine col:clickCol+1.
-	    (')]}>' includes:ch) ifTrue:[
-		matchCol := clickCol + 1.
-	    ] ifFalse:[
-		('"' includes:ch) ifTrue:[
-		    scanCol := clickCol + 1.
-		    fwdScan := false
-		]
-	    ]
-	].
-	matchCol notNil ifTrue:[
-	    self searchForMatchingParenthesisFromLine:clickLine col:matchCol
-		   ifFound:[:line :col | 
-			    self selectFromLine:clickLine col:matchCol
-				 toLine:line col:col.
-			    ^ self
-			   ]
-		   ifNotFound:[self showNotFound]
-		      onError:[self beep].
-	    ^ self
-	].
-	scanCol notNil ifTrue:[
-	    "/ if its an EOL comment, do it differently
-	    ch := self characterAtLine:clickLine col:clickCol.
-	    ch == $/ ifTrue:[
-		self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
-		^ self
-	    ].
-
-	    self scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan
-		 ifFound:[:line :col |
-			    fwdScan ifTrue:[
-				self selectFromLine:clickLine col:scanCol+1
-				     toLine:line col:col-1.
-			    ] ifFalse:[
-				self selectFromLine:clickLine col:scanCol-1
-				     toLine:line col:col+1.
-			    ].
-			    ^ self
-			   ]
-		 ifNotFound:[self showNotFound].
-	    ^ self
-	]
+        "/ st80 selects:
+        "/   if clicked right after a parenthesis -> select to matching parenthesis
+        "/   if clicked at beginning of the line  -> select that line
+        "/   if clicked at the top of the text    -> select all
+        "/
+        clickCol == 1 ifTrue:[
+            clickLine == 1 ifTrue:[
+                self selectAll.
+                ^ self.
+            ].
+            self selectLineAtY:y.
+            selectStyle := #line.
+            ^ self
+        ].
+
+        matchCol := nil.
+        "/ see what is to the left of that character ...
+        clickCol > 1 ifTrue:[
+            ch := self characterAtLine:clickLine col:clickCol-1.
+            ('([{<' includes:ch) ifTrue:[
+                matchCol := clickCol - 1
+            ] ifFalse:[
+                ('"' includes:ch) ifTrue:[
+                    scanCol := clickCol - 1.
+                    fwdScan := true
+                ]
+            ]
+        ].
+        clickCol < (self listAt:clickLine) size ifTrue:[
+            ch := self characterAtLine:clickLine col:clickCol+1.
+            (')]}>' includes:ch) ifTrue:[
+                matchCol := clickCol + 1.
+            ] ifFalse:[
+                ('"' includes:ch) ifTrue:[
+                    scanCol := clickCol + 1.
+                    fwdScan := false
+                ]
+            ]
+        ].
+        matchCol notNil ifTrue:[
+            self searchForMatchingParenthesisFromLine:clickLine col:matchCol
+                   ifFound:[:line :col | 
+                            self selectFromLine:clickLine col:matchCol
+                                 toLine:line col:col.
+                            ^ self
+                           ]
+                   ifNotFound:[self showNotFound]
+                      onError:[self beep].
+            ^ self
+        ].
+        scanCol notNil ifTrue:[
+            "/ if its an EOL comment, do it differently
+            ch := self characterAtLine:clickLine col:clickCol.
+            ch == $/ ifTrue:[
+                self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
+                ^ self
+            ].
+
+            self scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan
+                 ifFound:[:line :col |
+                            |selStart selEnd|
+
+                            fwdScan ifTrue:[
+                                selStart := scanCol+1.
+                                selEnd := col-1.
+                            ] ifFalse:[
+                                selStart := scanCol-1.
+                                selEnd := col+1.
+                            ].
+                            self selectFromLine:clickLine col:selStart
+                                 toLine:line col:selEnd.
+                            ^ self
+                           ]
+                 ifNotFound:[self showNotFound].
+            ^ self
+        ]
     ].
 
     self selectWordAtX:x y:y.
@@ -973,48 +977,48 @@
     "
     ((sel := self selection) size == 1 
     and:[(sel := sel at:1) size == 1]) ifTrue:[
-	ch := sel at:1.
-	('()[]{}<>' includes:ch) ifTrue:[
-	    self searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
-		  ifFound:[:line :col | 
-			      |prevLine prevCol moveBack pos1|
-
-			      prevLine := firstLineShown.
-			      prevCol := leftOffset.
-			      self selectFromLine:selectionStartLine col:selectionStartCol
-					   toLine:line col:col.
-
-			      self sensor ctrlDown ifFalse:[
-				  "/ undo scroll operation ...
-				  self withCursor:Cursor eye do:[  
-				      moveBack := false.
-				      (')]}>' includes:ch) ifTrue:[
-					   (firstLineShown ~~ prevLine or:[prevCol ~~ leftOffset]) ifTrue:[
-					       moveBack := true
-					   ] 
-				      ] ifFalse:[
-					   selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
-					       self makeLineVisible:selectionEndLine.
-					       moveBack := true
-					   ]
-				      ].
-				      moveBack ifTrue:[
-					   pos1 := x@y. 
-					   self invalidateRepairNow:true.
-					   Delay waitForSeconds:MatchDelayTime. 
+        ch := sel at:1.
+        ('()[]{}<>' includes:ch) ifTrue:[
+            self searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
+                  ifFound:[:line :col | 
+                              |prevLine prevCol moveBack pos1|
+
+                              prevLine := firstLineShown.
+                              prevCol := leftOffset.
+                              self selectFromLine:selectionStartLine col:selectionStartCol
+                                           toLine:line col:col.
+
+                              self sensor ctrlDown ifFalse:[
+                                  "/ undo scroll operation ...
+                                  self withCursor:Cursor eye do:[  
+                                      moveBack := false.
+                                      (')]}>' includes:ch) ifTrue:[
+                                           (firstLineShown ~~ prevLine or:[prevCol ~~ leftOffset]) ifTrue:[
+                                               moveBack := true
+                                           ] 
+                                      ] ifFalse:[
+                                           selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
+                                               self makeLineVisible:selectionEndLine.
+                                               moveBack := true
+                                           ]
+                                      ].
+                                      moveBack ifTrue:[
+                                           pos1 := x@y. 
+                                           self invalidateRepairNow:true.
+                                           Delay waitForSeconds:MatchDelayTime. 
                                             
-					   [self sensor hasUserEventFor:self] whileFalse:[
-						Delay waitForSeconds:MatchDelayTime / 2.
-					   ].
-					   self scrollToLine:prevLine; scrollToCol:prevCol.
-				      ].
-				  ]
-			      ]
-			  ]
-	       ifNotFound:[self showNotFound]
-		  onError:[self beep].
-	    selectStyle := nil
-	]
+                                           [self sensor hasUserEventFor:self] whileFalse:[
+                                                Delay waitForSeconds:MatchDelayTime / 2.
+                                           ].
+                                           self scrollToLine:prevLine; scrollToCol:prevCol.
+                                      ].
+                                  ]
+                              ]
+                          ]
+               ifNotFound:[self showNotFound]
+                  onError:[self beep].
+            selectStyle := nil
+        ]
     ].
 
     "
@@ -1023,14 +1027,14 @@
     wordStartLine := selectionStartLine.
     wordEndLine := selectionEndLine.
     selectStyle == #wordLeft ifTrue:[
-	wordStartCol := selectionStartCol + 1
+        wordStartCol := selectionStartCol + 1
     ] ifFalse:[
-	wordStartCol := selectionStartCol.
+        wordStartCol := selectionStartCol.
     ].
     selectStyle == #wordRight ifTrue:[
-	wordEndCol := selectionEndCol - 1
+        wordEndCol := selectionEndCol - 1
     ] ifFalse:[
-	wordEndCol := selectionEndCol
+        wordEndCol := selectionEndCol
     ]
 
     "Created: 11.9.1997 / 04:12:55 / cg"
@@ -2922,5 +2926,5 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.133 1999-04-14 11:08:47 tm Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.134 1999-04-21 10:34:56 cg Exp $'
 ! !