HierarchicalListView.st
changeset 2317 5f44d976c81f
parent 2316 f91a9635462e
child 2325 c478a0a3619e
--- a/HierarchicalListView.st	Sun Oct 20 14:17:51 2002 +0200
+++ b/HierarchicalListView.st	Mon Oct 21 10:34:57 2002 +0200
@@ -538,7 +538,7 @@
     "line changed at position; check whether line height changed
     "
     |item
-     lv "{ Class:SmallInteger }"
+     level "{ Class:SmallInteger }"
      x0 "{ Class:SmallInteger }"
      x1 "{ Class:SmallInteger }"
      y0 "{ Class:SmallInteger }"
@@ -547,10 +547,9 @@
     |
 
     item := list at:aLnNr ifAbsent:nil.
+    item isNil ifTrue:[^ self].
 
     (arg == #icon or:[arg == #hierarchy]) ifFalse:[
-        item isNil ifTrue:[^ self].
-
         super lineChangedAt:aLnNr with:arg.
 
         (arg ~~ #redraw and:[widthOfContents notNil]) ifTrue:[
@@ -565,11 +564,12 @@
         ].
         ^ self
     ].
+    level := item level.
 
     (alignTextRight and:[arg == #hierarchy]) ifTrue:[
         "/ must test whether alignTextRightX is enough
-        (item notNil and:[item isExpanded and:[item hasChildren]]) ifTrue:[        
-            x0 := self xOfFigureLevel:(item level + 2).
+        (item isExpanded and:[item hasChildren]) ifTrue:[        
+            x0 := self xOfFigureLevel:(level + 2).
 
             alignTextRightX < x0 ifTrue:[
                 alignTextRightX := x0.
@@ -592,22 +592,18 @@
     y1 := (self yVisibleOfLine:(aLnNr + 1)) min:yB.
     y1 > y0 ifFalse:[^ self].
 
-    x0 := margin.
-    x1 := width - margin.
+    x1 := (self xOfStringLevel:level) - 1.
+    x1 > margin ifFalse:[^ self].
 
-    (item := list at:aLnNr ifAbsent:nil) isNil ifFalse:[
-        lv := item level.
-        x1 := (self xOfStringLevel:lv) - (textStartLeft // 2).
+    arg == #hierarchy ifTrue:[ level := level - 1 ].
 
-        arg == #hierarchy ifTrue:[ lv := lv - 1 ].
+    x0 := (self xOfFigureLevel:level) max:margin.
+    x1 := x1 min:(width - margin).
 
-        x0 := (self xOfFigureLevel:lv) max:margin.
-        x1 := x1 min:(width - margin).
-        x1 > x0 ifFalse:[^ self]
+    x0 < x1 ifTrue:[
+        self invalidate:(Rectangle left:x0 top:y0 width:(x1 - x0) height:(y1 - y0)) 
+              repairNow:false.
     ].
-
-    self invalidate:(Rectangle left:x0 top:y0 width:(x1 - x0) height:(y1 - y0)) 
-          repairNow:false.
 !
 
 listChangedInsert:firstAddedIndex nItems:nLines
@@ -1478,5 +1474,5 @@
 !HierarchicalListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.61 2002-10-20 12:17:51 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.62 2002-10-21 08:34:57 ca Exp $'
 ! !