class: ListView
changed:
#listAt:from:to:
#listAt:to:
fixed taking a selection from behind the end of a line
(did strip off trailing spaces).
This affected doits ("$ " at the end) and copy/paste
of spaces.
--- a/ListView.st Thu Jun 27 21:24:55 2013 +0200
+++ b/ListView.st Thu Jun 27 22:01:43 2013 +0200
@@ -2680,27 +2680,45 @@
listAt:lineNr from:startCol to:endCol
"return substring from startCol to endCol of a line"
- |line stop lineLen|
+ |line lineLen nCols|
+
+ nCols := (endCol - startCol + 1).
line := self listAt:lineNr.
- line isNil ifTrue:[^ nil].
-
lineLen := line size.
- (startCol > lineLen) ifTrue:[^ nil].
- stop := endCol.
- (stop > lineLen) ifTrue:[stop := lineLen].
- ^ line copyFrom:startCol to:stop
+
+ (line isNil or:[startCol > lineLen]) ifTrue:[
+ (nCols > 0) ifTrue:[
+ ^ (String new:nCols)
+ ].
+ ^ nil
+ ].
+
+ (endCol > lineLen) ifTrue:[
+ ^ (line copyFrom:startCol to:lineLen) , (String new:(endCol-lineLen))
+ ].
+ ^ line copyFrom:startCol to:endCol
!
listAt:lineNr to:endCol
"return left substring from start to endCol of a line"
- |line stop|
+ |line stop lineSize|
line := self listAt:lineNr.
- line isNil ifTrue:[^ nil].
+ line isNil ifTrue:[
+ (stop > 0) ifTrue:[
+ ^ (String new:stop)
+ ].
+ ^ nil
+ ].
+
+ lineSize := line size.
stop := endCol.
- (stop > line size) ifTrue:[stop := line size].
+
+ (stop > lineSize) ifTrue:[
+ ^ (line copyTo:lineSize) , (String new:(stop - lineSize)).
+ ].
^ line copyTo:stop
!
@@ -4900,10 +4918,10 @@
!ListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.369 2013-06-27 19:24:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.370 2013-06-27 20:01:43 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.369 2013-06-27 19:24:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.370 2013-06-27 20:01:43 cg Exp $'
! !