*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Thu, 22 Mar 2001 13:42:36 +0100
changeset 2348 630ad2e7092e
parent 2347 ee1bc97c56e1
child 2349 0f6c87cbbb9e
*** empty log message ***
ListView.st
--- a/ListView.st	Wed Mar 21 10:16:05 2001 +0100
+++ b/ListView.st	Thu Mar 22 13:42:36 2001 +0100
@@ -630,6 +630,8 @@
 add:aString beforeIndex:index
     "add a line and redisplay"
 
+    |lastShown|
+
     list isNil ifTrue:[list := OrderedCollection new].
     list add:aString beforeIndex:index.
 
@@ -642,10 +644,14 @@
 "/        includesNonStrings ifTrue:[self getFontParameters].
     ].
     shown ifTrue:[
-        index to:self lastLineShown do:[:eachLine |
-            self invalidateLine:eachLine
+        lastShown := self lastLineShown.
+        index <= 2 ifTrue:[
+            self invalidate
+        ] ifFalse:[
+            index to:lastShown do:[:eachLine |
+                self invalidateLine:eachLine
+            ].
         ].
-        "/ self redrawFromLine:index.
     ].
     self contentsChanged.             "recompute scrollbars"
 
@@ -657,23 +663,36 @@
 !
 
 addAll:aCollectionOfLines beforeIndex:index
-    "add a line and redisplay"
+    "add a bunch of lines and redisplay"
+
+    |lastShown|
 
     list isNil ifTrue:[list := OrderedCollection new].
     aCollectionOfLines do:[:eachLine |
         list addAll:aCollectionOfLines beforeIndex:index.
     ].
+    includesNonStrings ifFalse:[
+        aCollectionOfLines do:[:eachLine |
+            includesNonStrings := includesNonStrings or:[(eachLine notNil and:[eachLine isString not])].
+        ]
+    ].
 
     widthOfWidestLine := nil. "/ i.e. unknown
     self textChanged.
 
-    ((index-1) <= self lastLineShown) ifTrue:[
-        index-1 to:self lastLineShown do:[:eachLine |
-            self invalidateLine:eachLine
+    shown ifTrue:[
+        lastShown := self lastLineShown.
+        ((index-1) <= lastShown) ifTrue:[
+            index <= 2 ifTrue:[
+                self invalidate
+            ] ifFalse:[
+                index-1 to:lastShown do:[:eachLine |
+                    self invalidateLine:eachLine
+                ].
+                "/  self redrawFromLine:index-1.
+            ].
         ].
-        "/  self redrawFromLine:index-1.
     ].
-
     self contentsChanged.             "recompute scrollbars"
 
     (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
@@ -681,7 +700,6 @@
             self scrollToBottom.
         "/ ]
     ].
-
 !
 
 at:lineNr
@@ -4298,5 +4316,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.250 2001-03-21 09:16:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.251 2001-03-22 12:42:36 cg Exp $'
 ! !