*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 05 Oct 2001 12:13:54 +0200
changeset 2431 be43e0e40cce
parent 2430 d8f21cf216fb
child 2432 af5d3ff6204b
*** empty log message ***
ListView.st
--- a/ListView.st	Fri Oct 05 10:57:52 2001 +0200
+++ b/ListView.st	Fri Oct 05 12:13:54 2001 +0200
@@ -13,10 +13,10 @@
 "{ Package: 'stx:libwidg' }"
 
 View subclass:#ListView
-	instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown
-		fgColor bgColor partialLines leftMargin topMargin textStartLeft
-		textStartTop innerWidth tabPositions lineSpacing fontHeight
-		fontAscent fontIsFixedWidth fontWidth autoScroll autoScrollBlock
+	instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown fgColor bgColor
+		partialLines leftMargin topMargin textStartLeft textStartTop
+		innerWidth tabPositions lineSpacing fontHeight fontAscent
+		fontIsFixedWidth fontWidth autoScroll autoScrollBlock
 		autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine
 		listMsg viewOrigin listChannel backgroundAlreadyClearedColor
 		scrollWhenUpdating'
@@ -927,22 +927,22 @@
      (the nonStrings information is remembered to optimize later redraws & height computations)."
 
     |oldFirst oldLeft nonStringsBefore fontHeightBefore
-     scrollToEnd scrollToTop newLeftOffset|
+     scrollToEnd scrollToTop newLeftOffset wText|
 
     scrollToTop := scrollWhenUpdating == #begin or:[scrollWhenUpdating == #beginOfText].
     scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText].
 
     (aCollection isNil and:[list isNil]) ifTrue:[
-	"no contents change"
-	scrollToTop ifTrue:[
-	    self scrollToTop.
-	] ifFalse:[
-	    scrollToEnd ifTrue:[
-		self scrollToBottom.
-	    ]
-	].
-	self scrollToLeft.
-	^ self
+        "no contents change"
+        scrollToTop ifTrue:[
+            self scrollToTop.
+        ] ifFalse:[
+            scrollToEnd ifTrue:[
+                self scrollToBottom.
+            ]
+        ].
+        self scrollToLeft.
+        ^ self
     ].
     list := aCollection.
 
@@ -951,18 +951,18 @@
     includesNonStrings := false.
 
     list notNil ifTrue:[
-	expand ifTrue:[
-	    self expandTabs
-	] ifFalse:[
-	    scan ifTrue:[
-		includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
-	    ] ifFalse:[
-		includesNonStrings := nonStrings
-	    ]
-	].
+        expand ifTrue:[
+            self expandTabs
+        ] ifFalse:[
+            scan ifTrue:[
+                includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
+            ] ifFalse:[
+                includesNonStrings := nonStrings
+            ]
+        ].
     ].
     (includesNonStrings ~~ nonStringsBefore) ifTrue:[
-	self getFontParameters.
+        self getFontParameters.
     ].
 
     widthOfWidestLine := nil.   "/ i.e. unknown
@@ -970,49 +970,50 @@
     oldLeft := viewOrigin x.
 
     (includesNonStrings ~~ nonStringsBefore) ifTrue:[
-	self computeNumberOfLinesShown.
+        self computeNumberOfLinesShown.
     ].
 
     newLeftOffset := viewOrigin x.
     scrollToTop ifTrue:[
-	firstLineShown := 1.
-	newLeftOffset := 0.
+        firstLineShown := 1.
+        newLeftOffset := 0.
     ] ifFalse:[
-	scrollToEnd ifTrue:[
-	    firstLineShown := (list size - nFullLinesShown + 1) max:1.
-	    newLeftOffset := 0.
-	]
+        scrollToEnd ifTrue:[
+            firstLineShown := (list size - nFullLinesShown + 1) max:1.
+            newLeftOffset := 0.
+        ]
     ].
     newLeftOffset > 0 ifTrue:[
-	self widthOfContents <= self innerWidth ifTrue:[
-	    newLeftOffset := 0.
-	].
+        wText := self widthOfContents.
+        (viewOrigin x + self innerWidth) > wText ifTrue:[
+            newLeftOffset := wText - self innerWidth.
+        ].
     ].
     newLeftOffset ~= oldLeft ifTrue:[ 
-	viewOrigin := newLeftOffset @ viewOrigin y.
+        viewOrigin := newLeftOffset @ viewOrigin y.
     ].
 
     realized ifTrue:[
-	self contentsChanged.
-	"
-	 dont use scroll here to avoid double redraw
-	"
-	viewOrigin := viewOrigin ifNil:[0@0] ifNotNil:[(viewOrigin x) @ 0].
-	transformation := nil.
-
-	oldFirst ~~ firstLineShown ifTrue:[
-	    self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
-	].
-	shown ifTrue:[
-	    self redrawFromVisibleLine:1 to:nLinesShown.
-
-	    fontHeightBefore > fontHeight ifTrue:[
-		(self listLineIsVisible:(self size)) ifTrue:[
+        self contentsChanged.
+        "
+         dont use scroll here to avoid double redraw
+        "
+        viewOrigin := viewOrigin ifNil:[0@0] ifNotNil:[(viewOrigin x) @ 0].
+        transformation := nil.
+
+        oldFirst ~~ firstLineShown ifTrue:[
+            self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
+        ].
+        shown ifTrue:[
+            self redrawFromVisibleLine:1 to:nLinesShown.
+
+            fontHeightBefore > fontHeight ifTrue:[
+                (self listLineIsVisible:(self size)) ifTrue:[
 "/                    self clearRectangle:((margin @ (self yOfVisibleLine:nLinesShown+1))
 "/                                        corner:(width-margin) @ (height-margin)).
-		].
-	    ]
-	]
+                ].
+            ]
+        ]
     ]
 
     "Modified: / 30.8.1995 / 19:07:13 / claus"
@@ -4394,5 +4395,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.258 2001-10-05 08:57:52 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.259 2001-10-05 10:13:54 cg Exp $'
 ! !