ListView.st
changeset 4448 2e4bb12f298c
parent 4444 3cffa8b45961
child 4463 8bfe40af7940
equal deleted inserted replaced
4447:3cdd4085a7fd 4448:2e4bb12f298c
  3144 !
  3144 !
  3145 
  3145 
  3146 lineOfCharacterPosition:charPos
  3146 lineOfCharacterPosition:charPos
  3147     "given a character index within the contents-string,
  3147     "given a character index within the contents-string,
  3148      return the lineNumber where the character is
  3148      return the lineNumber where the character is
  3149      - used to find line to hilight from Compilers error-position"
  3149      - used to find line to hilight from compiler's error-position"
  3150 
  3150 
  3151     |lineNr sum lastLine lineEndCharSize l|
  3151     |lineNr sum lastLine lineEndCharSize l|
  3152 
  3152 
  3153     lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1].
  3153     lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1].
  3154 
  3154 
  3162     ].
  3162     ].
  3163     sum == charPos ifTrue:[
  3163     sum == charPos ifTrue:[
  3164         ^ lineNr
  3164         ^ lineNr
  3165     ].
  3165     ].
  3166 
  3166 
  3167     ^ lineNr - 1
  3167     ^ (lineNr - 1) max:1
  3168 
  3168 
  3169     "Modified: / 04-07-2006 / 19:13:32 / fm"
  3169     "Modified: / 04-07-2006 / 19:13:32 / fm"
  3170     "Modified: / 21-08-2011 / 10:50:12 / cg"
  3170     "Modified: / 21-08-2011 / 10:50:12 / cg"
  3171 !
  3171 !
  3172 
  3172 
  4708 ! !
  4708 ! !
  4709 
  4709 
  4710 !ListView class methodsFor:'documentation'!
  4710 !ListView class methodsFor:'documentation'!
  4711 
  4711 
  4712 version_CVS
  4712 version_CVS
  4713     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.353 2012-08-05 10:24:12 cg Exp $'
  4713     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.354 2012-08-23 14:35:13 cg Exp $'
  4714 ! !
  4714 ! !