class: TextView
authorClaus Gittinger <cg@exept.de>
Thu, 26 Sep 2013 17:10:27 +0200
changeset 4787 cc11ec8d6855
parent 4786 70fd2d143e7c
child 4788 8ac7fbb56cb5
class: TextView changed:5 methods oops: selectionChanged was not always called
TextView.st
--- a/TextView.st	Wed Sep 25 17:29:36 2013 +0200
+++ b/TextView.st	Thu Sep 26 17:10:27 2013 +0200
@@ -4317,30 +4317,31 @@
     |l t|
 
     selectionStartLine notNil ifTrue:[
-	expandingTop == true ifTrue:[
-	    l := selectionStartLine.
-	    selectionStartLine := selectionStartLine + 1.
-	    (selectionStartLine > clickLine
-	    or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
-	    ifTrue:[
-		t := selectionStartLine.
-		selectionStartLine := selectionEndLine.
-		selectionEndLine := t.
-		t := selectionStartCol.
-		selectionStartCol := selectionEndCol.
-		selectionEndCol := t.
-		expandingTop := false
-	    ].
-	] ifFalse:[
-	    l := selectionEndLine.
-	    selectionEndLine := selectionEndLine + 1.
-	].
+        expandingTop == true ifTrue:[
+            l := selectionStartLine.
+            selectionStartLine := selectionStartLine + 1.
+            (selectionStartLine > clickLine
+            or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
+            ifTrue:[
+                t := selectionStartLine.
+                selectionStartLine := selectionEndLine.
+                selectionEndLine := t.
+                t := selectionStartCol.
+                selectionStartCol := selectionEndCol.
+                selectionEndCol := t.
+                expandingTop := false
+            ].
+        ] ifFalse:[
+            l := selectionEndLine.
+            selectionEndLine := selectionEndLine + 1.
+        ].
 "/        self redrawLine:l.
 "/        self redrawLine:l+1.
-	self validateNewSelection.
-	self setPrimarySelection.
-	self redrawFromLine:l to:l+1.
-	self makeSelectionVisible.
+        self validateNewSelection.
+        self setPrimarySelection.
+        self selectionChanged.
+        self redrawFromLine:l to:l+1.
+        self makeSelectionVisible.
     ].
 
     "Created: / 01-03-1996 / 23:35:08 / cg"
@@ -4352,33 +4353,34 @@
     |c l t c1 c2|
 
     selectionStartLine notNil ifTrue:[
-	expandingTop == true ifTrue:[
-	    selectionStartCol == 0 ifTrue:[^ self].
-	    l := selectionStartLine.
-	    selectionStartCol := (selectionStartCol - 1) max:1.
-	    c := selectionStartCol.
-	] ifFalse:[
-	    l := selectionEndLine.
-	    selectionEndCol := (selectionEndCol - 1) max:0.
-	    c := selectionEndCol.
-	    selectionEndLine == selectionStartLine ifTrue:[
-		selectionEndCol <= selectionStartCol ifTrue:[
-		    t := selectionStartCol. selectionStartCol := selectionEndCol.
-		    selectionEndCol := t.
-		    expandingTop := true.
-		    c := selectionStartCol.
-		]
-	    ].
-	].
-	c1 := c.
-	c2 := c1 + 1.
-	c1 == 0 ifTrue:[
-	    c1 := 1
-	].
-	self validateNewSelection.
-	self setPrimarySelection.
-	self redrawLine:l from:c1 to:c2.
-	self makeSelectionVisible.
+        expandingTop == true ifTrue:[
+            selectionStartCol == 0 ifTrue:[^ self].
+            l := selectionStartLine.
+            selectionStartCol := (selectionStartCol - 1) max:1.
+            c := selectionStartCol.
+        ] ifFalse:[
+            l := selectionEndLine.
+            selectionEndCol := (selectionEndCol - 1) max:0.
+            c := selectionEndCol.
+            selectionEndLine == selectionStartLine ifTrue:[
+                selectionEndCol <= selectionStartCol ifTrue:[
+                    t := selectionStartCol. selectionStartCol := selectionEndCol.
+                    selectionEndCol := t.
+                    expandingTop := true.
+                    c := selectionStartCol.
+                ]
+            ].
+        ].
+        c1 := c.
+        c2 := c1 + 1.
+        c1 == 0 ifTrue:[
+            c1 := 1
+        ].
+        self validateNewSelection.
+        self setPrimarySelection.
+        self selectionChanged.
+        self redrawLine:l from:c1 to:c2.
+        self makeSelectionVisible.
     ].
 
     "Modified: / 18-03-1996 / 17:05:46 / cg"
@@ -4389,28 +4391,29 @@
     |l c t|
 
     selectionStartLine notNil ifTrue:[
-	expandingTop == true ifTrue:[
-	    l := selectionStartLine.
-	    c := selectionStartCol.
-	    selectionStartCol := selectionStartCol + 1.
-	    l == selectionEndLine ifTrue:[
-		c >= selectionEndCol ifTrue:[
-		    expandingTop := false.
-		    t := selectionStartCol. selectionStartCol := selectionEndCol.
-		    selectionEndCol := t.
-		    c := selectionStartCol.
-		]
-	    ]
-	] ifFalse:[
-	    l := selectionEndLine.
-	    c := selectionEndCol.
-	    selectionEndCol := selectionEndCol + 1.
-	].
-
-	self validateNewSelection.
-	self setPrimarySelection.
-	self redrawLine:l from:c to:c+1.
-	self makeSelectionVisible.
+        expandingTop == true ifTrue:[
+            l := selectionStartLine.
+            c := selectionStartCol.
+            selectionStartCol := selectionStartCol + 1.
+            l == selectionEndLine ifTrue:[
+                c >= selectionEndCol ifTrue:[
+                    expandingTop := false.
+                    t := selectionStartCol. selectionStartCol := selectionEndCol.
+                    selectionEndCol := t.
+                    c := selectionStartCol.
+                ]
+            ]
+        ] ifFalse:[
+            l := selectionEndLine.
+            c := selectionEndCol.
+            selectionEndCol := selectionEndCol + 1.
+        ].
+
+        self validateNewSelection.
+        self setPrimarySelection.
+        self selectionChanged.
+        self redrawLine:l from:c to:c+1.
+        self makeSelectionVisible.
     ].
 
     "Created: / 01-03-1996 / 23:33:17 / cg"
@@ -4422,32 +4425,33 @@
     |l t|
 
     selectionStartLine notNil ifTrue:[
-	expandingTop == true ifTrue:[
-	    selectionStartLine := (selectionStartLine - 1) max:1.
-	    l := selectionStartLine.
-	] ifFalse:[
-	    selectionEndLine := (selectionEndLine - 1) max:0.
-
-	    l := selectionEndLine.
-	    (selectionEndLine < clickLine
-	    or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
-	    ifTrue:[
-		t := selectionStartLine.
-		selectionStartLine := selectionEndLine.
-		selectionEndLine := t.
-		t := selectionStartCol.
-		selectionStartCol := selectionEndCol.
-		selectionEndCol := t.
-		l := selectionStartLine.
-		expandingTop := true
-	    ].
-	].
-	self validateNewSelection.
-	self setPrimarySelection.
-	"/ self redrawLine:l.
-	"/ self redrawLine:l+1.
-	self redrawFromLine:l to:l+1.
-	self makeSelectionVisible.
+        expandingTop == true ifTrue:[
+            selectionStartLine := (selectionStartLine - 1) max:1.
+            l := selectionStartLine.
+        ] ifFalse:[
+            selectionEndLine := (selectionEndLine - 1) max:0.
+
+            l := selectionEndLine.
+            (selectionEndLine < clickLine
+            or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
+            ifTrue:[
+                t := selectionStartLine.
+                selectionStartLine := selectionEndLine.
+                selectionEndLine := t.
+                t := selectionStartCol.
+                selectionStartCol := selectionEndCol.
+                selectionEndCol := t.
+                l := selectionStartLine.
+                expandingTop := true
+            ].
+        ].
+        self validateNewSelection.
+        self setPrimarySelection.
+        self selectionChanged.
+        "/ self redrawLine:l.
+        "/ self redrawLine:l+1.
+        self redrawFromLine:l to:l+1.
+        self makeSelectionVisible.
     ].
 
     "Modified: / 06-03-1996 / 14:12:06 / cg"
@@ -4558,36 +4562,37 @@
 
     self unselect.
     startLine notNil ifTrue:[
-	"new:"
-	endLine < startLine ifTrue:[
-	    ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
-	].
-	(endLine == startLine and:[endCol < startCol]) ifTrue:[
-	    endCol ~~ 0 ifTrue:[
-		self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
-	    ].
-	    ^ self
-	].
+        "new:"
+        endLine < startLine ifTrue:[
+            ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
+        ].
+        (endLine == startLine and:[endCol < startCol]) ifTrue:[
+            endCol ~~ 0 ifTrue:[
+                self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
+            ].
+            ^ self
+        ].
 
 " old:
-	endLine < startLine ifTrue:[^ self].
-	(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
+        endLine < startLine ifTrue:[^ self].
+        (startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
 "
-	selectionStartLine := startLine.
-	selectionStartCol := startCol.
-	selectionEndLine := endLine.
-	selectionEndCol := endCol.
-	self validateNewSelection.
-	self setPrimarySelection.
-
-	(selectionStartLine == selectionEndLine) ifTrue:[
-	    self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
-	] ifFalse:[
-	    selectionStartLine to:selectionEndLine do:[:lineNr |
-		self redrawLine:lineNr
-	    ]
-	].
-	selectStyle := nil.
+        selectionStartLine := startLine.
+        selectionStartCol := startCol.
+        selectionEndLine := endLine.
+        selectionEndCol := endCol.
+        self validateNewSelection.
+        self setPrimarySelection.
+        self selectionChanged.
+
+        (selectionStartLine == selectionEndLine) ifTrue:[
+            self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
+        ] ifFalse:[
+            selectionStartLine to:selectionEndLine do:[:lineNr |
+                self redrawLine:lineNr
+            ]
+        ].
+        selectStyle := nil.
     ]
 
     "
@@ -4837,11 +4842,11 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.365 2013-09-25 10:34:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.366 2013-09-26 15:10:27 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.365 2013-09-25 10:34:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.366 2013-09-26 15:10:27 cg Exp $'
 ! !