do not draw using fromCol:toCol:, if there is a chance
authorClaus Gittinger <cg@exept.de>
Thu, 22 Jan 1998 21:08:39 +0100
changeset 1425 31c50dd004b5
parent 1424 e90680159109
child 1426 de76570ba19e
do not draw using fromCol:toCol:, if there is a chance of an emphasis change in any line.
ListView.st
--- a/ListView.st	Wed Jan 21 19:34:34 1998 +0100
+++ b/ListView.st	Thu Jan 22 21:08:39 1998 +0100
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:3.2.1 on 20-oct-1997 at 3:05:41 pm'                  !
-
 View subclass:#ListView
 	instanceVariableNames:'list firstLineShown leftOffset nFullLinesShown nLinesShown
 		fgColor bgColor partialLines leftMargin topMargin textStartLeft
@@ -1401,7 +1399,7 @@
 redrawX:x y:y width:w height:h
     "a region must be redrawn"
 
-    |startLine stopLine startCol endCol|
+    |startLine stopLine startCol endCol line|
 
     shown ifFalse:[^ self].
 
@@ -1410,50 +1408,59 @@
 
     "if text-margin is affected"
     x < textStartLeft ifTrue:[
-	self paint:bgColor.
-	self fillRectangleX:margin y:margin width:(textStartLeft - margin)
-					   height:(height - margin - margin)
+        self paint:bgColor.
+        self fillRectangleX:margin y:margin width:(textStartLeft - margin)
+                                           height:(height - margin - margin)
     ].
     y < textStartTop ifTrue:[
-	self paint:bgColor.
-	self fillRectangleX:margin y:margin width:(width - margin - margin)
-					   height:(textStartTop - margin)
+        self paint:bgColor.
+        self fillRectangleX:margin y:margin width:(width - margin - margin)
+                                           height:(textStartTop - margin)
     ].
     (w > (width // 4 * 3)) ifTrue:[
-	"if area is big enough redraw whole lines"
-	self redrawFromVisibleLine:startLine to:stopLine
+        "if area is big enough redraw whole lines"
+        self redrawFromVisibleLine:startLine to:stopLine
     ] ifFalse:[
-	includesNonStrings ifTrue:[
-	    startLine to:stopLine do:[:i |
-		self redrawVisibleLine:i
-	    ]
-	] ifFalse:[
-	    fontIsFixedWidth ifFalse:[
-		"start/end col has to be computed for each line"
-
-		startLine to:stopLine do:[:i |
-		    startCol := self colOfX:x inVisibleLine:i.
-		    endCol := self colOfX:(x + w) inVisibleLine:i.
-		    startCol > 0 ifTrue:[
-			endCol > 0 ifTrue:[
-			    self redrawVisibleLine:i from:startCol to:endCol
-			]
-		    ]
-		]
-	    ] ifTrue:[
-		"start/end col is the same for all lines"
-
-		startCol := self colOfX:x inVisibleLine:startLine.
-		endCol := self colOfX:(x + w) inVisibleLine:startLine.
-		startCol > 0 ifTrue:[
-		    endCol > 0 ifTrue:[
-			startLine to:stopLine do:[:i |
-			    self redrawVisibleLine:i from:startCol to:endCol
-			]
-		    ]
-		]
-	    ]
-	]
+        includesNonStrings ifTrue:[
+            startLine to:stopLine do:[:i |
+                self redrawVisibleLine:i
+            ]
+        ] ifFalse:[
+            line := self visibleAt:startLine.
+
+            (fontIsFixedWidth 
+            and:[line notNil
+            and:[line isMemberOf:String]]) ifFalse:[
+                "start/end col has to be computed for each line"
+
+                startLine to:stopLine do:[:i |
+                    startCol := self colOfX:x inVisibleLine:i.
+                    endCol := self colOfX:(x + w) inVisibleLine:i.
+                    startCol > 0 ifTrue:[
+                        endCol > 0 ifTrue:[
+                            self redrawVisibleLine:i from:startCol to:endCol
+                        ]
+                    ]
+                ]
+            ] ifTrue:[
+                "start/end col is the same for all lines"
+
+                startCol := self colOfX:x inVisibleLine:startLine.
+                endCol := self colOfX:(x + w) inVisibleLine:startLine.
+                startCol > 0 ifTrue:[
+                    endCol > 0 ifTrue:[
+                        startLine to:stopLine do:[:i |
+                            line := self visibleAt:i.
+                            (i isMemberOf:String) ifTrue:[
+                                self redrawVisibleLine:i from:startCol to:endCol
+                            ] ifFalse:[
+                                self redrawVisibleLine:i
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ]
     ]
 !
 
@@ -3756,5 +3763,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.144 1997-10-21 18:13:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.145 1998-01-22 20:08:39 cg Exp $'
 ! !