#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Thu, 19 Sep 2019 14:53:24 +0200
changeset 6707 187a9556ae38
parent 6706 27448b51c873
child 6708 f11899d4bd49
#FEATURE by exept class: ListView added: #flushCachedWidthOfWidestLine comment/format in: #contentsChanged #list:expandTabs:scanForNonStrings:includesNonStrings:redraw:
ListView.st
--- a/ListView.st	Mon Sep 16 16:12:11 2019 +0200
+++ b/ListView.st	Thu Sep 19 14:53:24 2019 +0200
@@ -1005,6 +1005,14 @@
     "Modified (comment): / 23-04-2019 / 20:37:54 / Claus Gittinger"
 !
 
+flushCachedWidthOfWidestLine
+    "call this ,if the underlying contents changes without me getting to know
+     (i.e. if the line is a dynamically generated one,
+      such as a hexDump inside a virtual array)"
+
+    widthOfWidestLine := nil.
+!
+
 from:from to:to do:aBlock
     "evaluate aBlock on some of my lines"
 
@@ -2373,24 +2381,23 @@
     |listSize newOrigin|
 
     shown ifTrue:[
-	list notNil ifTrue:[
-	    listSize := self numberOfLines.
-
-	    listSize == 0 ifTrue:[
-		widthOfWidestLine := 0.
-	    ].
-
-	    "
-	     if we are beyond the end, scroll up a bit
-	    "
-	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
-		newOrigin := listSize - nFullLinesShown + 1.
-		newOrigin < 1 ifTrue:[
-		    newOrigin := 1
-		].
-		self scrollToLine: newOrigin.
-	    ].
-	].
+        list notNil ifTrue:[
+            listSize := self numberOfLines.
+            listSize == 0 ifTrue:[
+                widthOfWidestLine := 0.
+            ].
+
+            "
+             if we are beyond the end, scroll up a bit
+            "
+            ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
+                newOrigin := listSize - nFullLinesShown + 1.
+                newOrigin < 1 ifTrue:[
+                    newOrigin := 1
+                ].
+                self scrollToLine: newOrigin.
+            ].
+        ].
     ].
 
     ^ super contentsChanged