SelectionInListModelView.st
changeset 3205 7ff2e20b37d4
parent 3202 11de451bc538
child 3221 af3fae427c7e
--- a/SelectionInListModelView.st	Tue Mar 13 16:16:28 2007 +0100
+++ b/SelectionInListModelView.st	Tue Mar 13 16:16:38 2007 +0100
@@ -19,7 +19,7 @@
 		hilightBgColorNoFocus hilightLevel hilightFrameColor hilightStyle
 		dropSource editorView openEditorAction closeEditorAction
 		highlightEnterItem enterItem cursorItem lineMask keyActionStyle
-		returnKeyActionStyle strikeOut'
+		returnKeyActionStyle strikeOut modelChangedDuringButtonPress'
 	classVariableNames:'DefaultHilightStyle DefaultHilightBackgroundColor
 		DefaultHilightForegroundColor DefaultHilightLevel
 		DefaultHilightFrameColor'
@@ -1207,7 +1207,7 @@
     "
     |sensor item menu appl isSelected lineNr startLine dragDistance|
 
-    buttonMotionAction := buttonReleaseAction := nil.
+    modelChangedDuringButtonPress := buttonMotionAction := buttonReleaseAction := nil.
 
     self pointerEntersItem:nil.
     self cursorEntersItem:nil.
@@ -1260,6 +1260,7 @@
         ^ self
     ].
     lineNr isNil ifTrue:[ ^ self ].
+    modelChangedDuringButtonPress := false.
 
     sensor ctrlDown ifTrue:[
         self buttonControlPressAtLine:lineNr x:x y:y.
@@ -1368,7 +1369,10 @@
 buttonRelease:button x:x y:y
     "a button was released
     "
-    buttonMotionAction := nil.
+    |makeSelectionVisible|
+
+    makeSelectionVisible := modelChangedDuringButtonPress.
+    buttonMotionAction   := modelChangedDuringButtonPress := nil.
 
     buttonReleaseAction notNil ifTrue:[
         buttonReleaseAction value.
@@ -1377,6 +1381,10 @@
 
     self cursorEntersItem:nil.
     self stopAutoScroll.
+
+    (makeSelectionVisible == true and:[self hasSelection]) ifTrue:[
+        self makeSelectionVisible
+    ].
 !
 
 characterPress:aKey x:x y:y
@@ -2112,6 +2120,8 @@
 
     shown ifFalse:[^ self].
 
+    modelChangedDuringButtonPress notNil ifTrue:[^ self].
+
     firstLine := self firstInSelection.
     (firstLine isNil or:[firstLine == 0]) ifTrue:[^ self].
 
@@ -2371,9 +2381,15 @@
         ]
     ].
     selection = oldSelect ifTrue:[^ false].
+
+    modelChangedDuringButtonPress notNil ifTrue:[
+        modelChangedDuringButtonPress := true.
+    ].
+
     self closeEditor.
     self cursorEntersItem:nil.
 
+    
     (doRedraw and:[shown]) ifFalse:[
         ^ true
     ].
@@ -2396,5 +2412,5 @@
 !SelectionInListModelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.119 2007-03-12 15:25:20 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.120 2007-03-13 15:16:38 ca Exp $'
 ! !