ListView.st
changeset 5691 bbe1d9a93740
parent 5683 7027fccb78dd
child 5692 2fb164455e7c
child 5715 8baebc416a38
equal deleted inserted replaced
5690:aa63cb90fa9f 5691:bbe1d9a93740
  3384     self checkForExistingLine:lineNr.
  3384     self checkForExistingLine:lineNr.
  3385     charPos := 1.
  3385     charPos := 1.
  3386     1 to:(lineNr - 1) do:[:lnr |
  3386     1 to:(lineNr - 1) do:[:lnr |
  3387         lineString := self at:lnr.
  3387         lineString := self at:lnr.
  3388         lineString notNil ifTrue:[
  3388         lineString notNil ifTrue:[
  3389             charPos := charPos + (lineString string "withoutTrailingSeparators") size
  3389             charPos := charPos + (lineString string) size
  3390         ].
  3390         ].
  3391         charPos := charPos + lineEndCharSize   "the return-character"
  3391         charPos := charPos + lineEndCharSize   "the return-character"
  3392     ].
  3392     ].
  3393 
  3393 
  3394     "/ if beyond end of line, be careful to not advance into next line.
  3394     "/ NEW: expand that line, so that characterAtCharacterPosition returns the correct character 
       
  3395 "/ wrong: will modify!! 
       
  3396 "/    (lineString := self at:lineNr) size < colArg ifTrue:[
       
  3397 "/        "/ expand this line
       
  3398 "/        self at:lineNr put:((lineString ? ''),(String new:colArg-lineString size)).    
       
  3399 "/    ].
       
  3400 
       
  3401     "/ OLD: if beyond end of line, be careful to not advance into next line.
  3395     "/ otherwise, syntaxHighlighter (and others) walk into trouble,
  3402     "/ otherwise, syntaxHighlighter (and others) walk into trouble,
  3396     "/ if clicked on a space beyond a line's end.
  3403     "/ if clicked on a space beyond a line's end.
  3397     col := colArg min:((self at:lineNr) size + 1).
  3404     col := colArg min:((self at:lineNr) size + 1).
  3398     ^ charPos + col - 1
  3405     ^ charPos + col - 1
  3399 
  3406 
  3400     "Modified: / 04-07-2006 / 19:14:25 / fm"
  3407     "Modified: / 04-07-2006 / 19:14:25 / fm"
  3401     "Modified: / 21-08-2011 / 11:03:19 / cg"
  3408     "Modified: / 01-05-2016 / 15:48:24 / cg"
  3402 !
  3409 !
  3403 
  3410 
  3404 colOfCharacterPosition:charPos
  3411 colOfCharacterPosition:charPos
  3405     "given a character index within the contents-string,
  3412     "given a character index within the contents-string,
  3406      return the column number where the character is
  3413      return the column number where the character is