startOfLines can have nil at end; lookup the first not nil
authorClaus Gittinger <cg@exept.de>
Mon, 12 Jul 1999 20:04:29 +0200
changeset 1446 fb46beba2d0c
parent 1445 b272f318bdef
child 1447 aaebe212f08a
startOfLines can have nil at end; lookup the first not nil
ListModelView.st
--- a/ListModelView.st	Mon Jul 12 17:10:29 1999 +0200
+++ b/ListModelView.st	Mon Jul 12 20:04:29 1999 +0200
@@ -462,7 +462,7 @@
 
 !
 
-listChangedRemove:start toIndex:aStop
+listChangedRemove:aStart toIndex:aStop
     "list changed; items are removed
     "
     |noRedraw
@@ -477,12 +477,15 @@
      cpyHg "{ Class: SmallInteger }"
      maxHg "{ Class: SmallInteger }"
      stop  "{ Class: SmallInteger }"
+     start "{ Class: SmallInteger }"
     |
-    stop := aStop min:(list size).
+    stop  := aStop.
+    start := aStart.
 
-    (size := stop - start + 1) > 0 ifFalse:[
-        ^ self list:list.
+    (size := stop - start + 1) == 0 ifTrue:[
+        ^ self
     ].
+
     self listSizeChanged:start nLines:(size negated).
     shown not ifTrue:[^ self].
     absY0 := self yAbsoluteOfLine:start.
@@ -543,12 +546,6 @@
                        height:(maxHg - visY0).
     ].
     self contentsChanged.
-
-
-
-
-
-
 !
 
 syncUpdate:what with:args
@@ -873,7 +870,14 @@
 yAbsoluteOfLine:aLineNr
     "given a lineNr, return y-coordinate absolute
     "
-    ^ startOfLinesY at:aLineNr ifAbsent:[startOfLinesY last].
+    |n|
+
+    n := startOfLinesY at:aLineNr ifAbsent:[startOfLinesY last].
+
+    n isNil ifTrue:[
+        ^ startOfLinesY detect:[:x| x notNil] ifNone:[0]
+    ].
+    ^ n
 !
 
 yVisibleOfLine:aLineNr
@@ -1289,6 +1293,6 @@
 !ListModelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.12 1999-07-10 11:30:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.13 1999-07-12 18:04:29 cg Exp $'
 ! !
 ListModelView initialize!