3392 self checkForExistingLine:lineNr. |
3392 self checkForExistingLine:lineNr. |
3393 charPos := 1. |
3393 charPos := 1. |
3394 1 to:(lineNr - 1) do:[:lnr | |
3394 1 to:(lineNr - 1) do:[:lnr | |
3395 lineString := self at:lnr. |
3395 lineString := self at:lnr. |
3396 lineString notNil ifTrue:[ |
3396 lineString notNil ifTrue:[ |
3397 charPos := charPos + (lineString string "withoutTrailingSeparators") size |
3397 charPos := charPos + (lineString string) size |
3398 ]. |
3398 ]. |
3399 charPos := charPos + lineEndCharSize "the return-character" |
3399 charPos := charPos + lineEndCharSize "the return-character" |
3400 ]. |
3400 ]. |
3401 |
3401 |
3402 "/ if beyond end of line, be careful to not advance into next line. |
3402 "/ NEW: expand that line, so that characterAtCharacterPosition returns the correct character |
|
3403 "/ wrong: will modify!! |
|
3404 "/ (lineString := self at:lineNr) size < colArg ifTrue:[ |
|
3405 "/ "/ expand this line |
|
3406 "/ self at:lineNr put:((lineString ? ''),(String new:colArg-lineString size)). |
|
3407 "/ ]. |
|
3408 |
|
3409 "/ OLD: if beyond end of line, be careful to not advance into next line. |
3403 "/ otherwise, syntaxHighlighter (and others) walk into trouble, |
3410 "/ otherwise, syntaxHighlighter (and others) walk into trouble, |
3404 "/ if clicked on a space beyond a line's end. |
3411 "/ if clicked on a space beyond a line's end. |
3405 col := colArg min:((self at:lineNr) size + 1). |
3412 col := colArg min:((self at:lineNr) size + 1). |
3406 ^ charPos + col - 1 |
3413 ^ charPos + col - 1 |
3407 |
3414 |
3408 "Modified: / 04-07-2006 / 19:14:25 / fm" |
3415 "Modified: / 04-07-2006 / 19:14:25 / fm" |
3409 "Modified: / 21-08-2011 / 11:03:19 / cg" |
3416 "Modified: / 01-05-2016 / 15:48:24 / cg" |
3410 ! |
3417 ! |
3411 |
3418 |
3412 colOfCharacterPosition:charPos |
3419 colOfCharacterPosition:charPos |
3413 "given a character index within the contents-string, |
3420 "given a character index within the contents-string, |
3414 return the column number where the character is |
3421 return the column number where the character is |