eliminated direct write-access to cursorLine
authorClaus Gittinger <cg@exept.de>
Thu, 04 Oct 2001 14:59:02 +0200
changeset 2426 281067d406c7
parent 2425 f5eca590ec4f
child 2427 43cc7ea39bac
eliminated direct write-access to cursorLine
TextCollector.st
--- a/TextCollector.st	Thu Oct 04 14:58:10 2001 +0200
+++ b/TextCollector.st	Thu Oct 04 14:59:02 2001 +0200
@@ -432,20 +432,21 @@
      and cuts off some lines at the top if so; it must be called whenever lines
      have been added to the bottom"
 
-    |nDel|
+    |nDel newCursorLine|
 
     lineLimit notNil ifTrue:[
-	(cursorLine > lineLimit) ifTrue:[
-	    nDel := list size - lineLimit.
-	    list removeFromIndex:1 toIndex:nDel.
-	    cursorLine := cursorLine - nDel.
-	    firstLineShown := firstLineShown - nDel.
-	    (firstLineShown < 1) ifTrue:[
-		cursorLine := cursorLine - firstLineShown + 1.
-		firstLineShown := 1
-	    ].
-	    self contentsChanged
-	]
+        (cursorLine > lineLimit) ifTrue:[
+            nDel := list size - lineLimit.
+            list removeFromIndex:1 toIndex:nDel.
+            newCursorLine := cursorLine - nDel.
+            firstLineShown := firstLineShown - nDel.
+            (firstLineShown < 1) ifTrue:[
+                newCursorLine := newCursorLine - firstLineShown + 1.
+                firstLineShown := 1
+            ].
+            self setCursorLine:newCursorLine.
+            self contentsChanged
+        ]
     ]
 !
 
@@ -785,6 +786,6 @@
 !TextCollector class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.67 2001-06-11 09:20:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.68 2001-10-04 12:59:02 cg Exp $'
 ! !
 TextCollector initialize!