SelectionInListView.st
branchjv
changeset 6009 e40141d51a0e
parent 5981 50c1bb3e9f98
parent 5992 9c05410340c1
child 6085 4ecbe3a93aec
--- a/SelectionInListView.st	Wed Dec 07 12:00:07 2016 +0000
+++ b/SelectionInListView.st	Thu Dec 08 10:30:26 2016 +0000
@@ -2731,16 +2731,20 @@
 !
 
 sizeChanged:how
+    self sizeChanged:how from:nil
+!
+
+sizeChanged:how from:oldExtent
     "if there is a selection, make certain, it is visible
-     after the sizechange"
-
-    |first wasAtEnd selectionWasWisible oldFirst|
+     after the sizechange."
+
+    |first wasAtEnd selectionWasVisible oldFirst|
 
     widthOfWidestLine := nil.
     oldFirst := firstLineShown.
     wasAtEnd := (nFullLinesShown < list size) and:[ (firstLineShown + nFullLinesShown) >= list size ].
 
-    selectionWasWisible := false.
+    selectionWasVisible := false.
     selection notNil ifTrue:[
         self multipleSelectOk ifTrue:[
             first := selection firstIfEmpty:nil
@@ -2748,7 +2752,7 @@
             first := selection
         ].
         first notNil ifTrue:[
-            selectionWasWisible := (first between:firstLineShown and:(firstLineShown + nFullLinesShown)).
+            selectionWasVisible := (first between:firstLineShown and:(firstLineShown + nFullLinesShown)).
         ]
     ].
 
@@ -2760,23 +2764,25 @@
     ].
 
     shown ifTrue:[
-        selection size > 0 ifTrue:[
-            selectionWasWisible ifTrue:[
-                self multipleSelectOk ifTrue:[
-                    first := selection firstIfEmpty:nil
-                ] ifFalse:[
-                    first := selection
-                ].
-                first notNil ifTrue:[self makeLineVisible:first]
-            ]
-        ] ifFalse:[
-            "
-             if we were at the end before, move to the end again.
-             Still to be seen, if this is better in real life ...
-            "
-            wasAtEnd ifTrue:[
-                "at end"
-                self scrollToBottom
+        (oldExtent isNil or:[oldExtent y ~= height]) ifTrue:[
+            selection size > 0 ifTrue:[
+                selectionWasVisible ifTrue:[
+                    self multipleSelectOk ifTrue:[
+                        first := selection firstIfEmpty:nil
+                    ] ifFalse:[
+                        first := selection
+                    ].
+                    first notNil ifTrue:[self makeLineVisible:first]
+                ]
+            ] ifFalse:[
+                "
+                 if we were at the end before, move to the end again.
+                 Still to be seen, if this is better in real life ...
+                "
+                wasAtEnd ifTrue:[
+                    "at end"
+                    self scrollToBottom
+                ]
             ]
         ]
     ]