#DOCUMENTATION by cg
class: ListView
comment/format in: #characterPositionOfLine:col:
--- a/ListView.st Sun May 01 09:43:43 2016 +0200
+++ b/ListView.st Sun May 01 18:21:59 2016 +0200
@@ -3386,19 +3386,26 @@
1 to:(lineNr - 1) do:[:lnr |
lineString := self at:lnr.
lineString notNil ifTrue:[
- charPos := charPos + (lineString string "withoutTrailingSeparators") size
+ charPos := charPos + (lineString string) size
].
charPos := charPos + lineEndCharSize "the return-character"
].
- "/ if beyond end of line, be careful to not advance into next line.
+ "/ NEW: expand that line, so that characterAtCharacterPosition returns the correct character
+"/ wrong: will modify!!
+"/ (lineString := self at:lineNr) size < colArg ifTrue:[
+"/ "/ expand this line
+"/ self at:lineNr put:((lineString ? ''),(String new:colArg-lineString size)).
+"/ ].
+
+ "/ OLD: if beyond end of line, be careful to not advance into next line.
"/ otherwise, syntaxHighlighter (and others) walk into trouble,
"/ if clicked on a space beyond a line's end.
col := colArg min:((self at:lineNr) size + 1).
^ charPos + col - 1
"Modified: / 04-07-2006 / 19:14:25 / fm"
- "Modified: / 21-08-2011 / 11:03:19 / cg"
+ "Modified: / 01-05-2016 / 15:48:24 / cg"
!
colOfCharacterPosition:charPos