--- a/ListView.st Wed Jul 20 11:35:00 2016 +0200
+++ b/ListView.st Wed Jul 20 11:35:33 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -9,8 +11,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-'From Smalltalk/X, Version:7.1.0.0 on 15-07-2016 at 17:28:27' !
-
"{ Package: 'stx:libwidg' }"
"{ NameSpace: Smalltalk }"
@@ -2670,34 +2670,34 @@
"
(fontIsFixedWidth
and:[lineString isNil
- or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
- ^ (xRel // fontWidth) + 1
+ or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
+ ^ (xRel // fontWidth) + 1
].
"
for variable fonts, more work is required ...
"
lineString notNil ifTrue:[
- lineString := self visibleStringFrom:lineString.
- (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
- linePixelWidth := lineString widthOn:self
- ] ifFalse:[
- lineString := lineString string.
- linePixelWidth := gc font widthOf:lineString.
- ]
+ lineString := self visibleStringFrom:lineString.
+ (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
+ linePixelWidth := lineString widthOn:self
+ ] ifFalse:[
+ lineString := lineString string.
+ linePixelWidth := gc font widthOf:lineString.
+ ]
] ifFalse:[
- linePixelWidth := 0
+ linePixelWidth := 0
].
(linePixelWidth <= xRel) ifTrue:[
- fontWidth == 0 ifTrue:[
- "
- although this 'cannot happen',
- it seems that X reports this width for some strange fonts ...
- "
- ^ lineString size
- ].
- ^ lineString size + ((xRel - linePixelWidth) // fontWidth) + 1
+ fontWidth == 0 ifTrue:[
+ "
+ although this 'cannot happen',
+ it seems that X reports this width for some strange fonts ...
+ "
+ ^ lineString size
+ ].
+ ^ lineString size + ((xRel - linePixelWidth) // fontWidth) + 1
].
"/ cannot simply count individual characters,
@@ -2712,51 +2712,51 @@
"/ (runCol == 0) ifTrue:[runCol := 1].
hasEmphasis ifTrue:[
- posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
- posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
+ posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
+ posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
] ifFalse:[
- posLeft := gc font widthOf:lineString from:1 to:(runCol - 1).
- posRight := gc font widthOf:lineString from:1 to:runCol.
+ posLeft := gc font widthOf:lineString from:1 to:(runCol - 1).
+ posRight := gc font widthOf:lineString from:1 to:runCol.
].
done := (posLeft <= xRel) and:[posRight > xRel].
[done] whileFalse:[
- oPosRight := posRight.
- oPosLeft := posLeft.
-
- (posRight <= xRel) ifTrue:[
- runCol := runCol + 1.
- posLeft := posRight.
- hasEmphasis ifTrue:[
- posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
- ] ifFalse:[
- posRight := gc font widthOf:lineString from:1 to:runCol
- ]
- ] ifFalse:[
- (posLeft > xRel) ifTrue:[
- runCol := runCol - 1.
- (runCol == 0) ifTrue:[^ 0].
- posRight := posLeft.
- hasEmphasis ifTrue:[
- posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
- ] ifFalse:[
- posLeft := gc font widthOf:lineString from:1 to:(runCol - 1)
- ]
- ]
- ].
- done := (posLeft <= xRel) and:[posRight > xRel].
+ oPosRight := posRight.
+ oPosLeft := posLeft.
+
+ (posRight <= xRel) ifTrue:[
+ runCol := runCol + 1.
+ posLeft := posRight.
+ hasEmphasis ifTrue:[
+ posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
+ ] ifFalse:[
+ posRight := gc font widthOf:lineString from:1 to:runCol
+ ]
+ ] ifFalse:[
+ (posLeft > xRel) ifTrue:[
+ runCol := runCol - 1.
+ (runCol == 0) ifTrue:[^ 0].
+ posRight := posLeft.
+ hasEmphasis ifTrue:[
+ posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
+ ] ifFalse:[
+ posLeft := gc font widthOf:lineString from:1 to:(runCol - 1)
+ ]
+ ]
+ ].
+ done := (posLeft <= xRel) and:[posRight > xRel].
"234567890123456789012345678901234567890"
- ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
- "/ paranoia: just in case there are unprintable characters
- "/ (avoid endless loop if the binary search does not make progress)
- done := true.
- ]
+ ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
+ "/ paranoia: just in case there are unprintable characters
+ "/ (avoid endless loop if the binary search does not make progress)
+ done := true.
+ ]
].
"/self paint:Color red.
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr)
"/ width:(posRight-posLeft) height:fontHeight.
-"/self paint:Color black.
+"/self paint:self blackColor.
^ runCol
"Modified: / 25-04-2011 / 11:26:58 / cg"