added #colOfCharacterPosition:
authorClaus Gittinger <cg@exept.de>
Sat, 26 Jun 1999 18:29:35 +0200
changeset 1934 c1e997c794ee
parent 1933 a3d9c133279f
child 1935 b59ff4681762
added #colOfCharacterPosition:
ListView.st
--- a/ListView.st	Sat Jun 26 16:31:52 1999 +0200
+++ b/ListView.st	Sat Jun 26 18:29:35 1999 +0200
@@ -1819,6 +1819,18 @@
     ]
 !
 
+colOfCharacterPosition:charPos
+    "given a character index within the contents-string,
+     return the column number where the character is
+     - used to find line to hilight from Compilers error-position"
+
+    |line|
+
+    line := self lineOfCharacterPosition:charPos.
+    ^ charPos - (self characterPositionOfLine:line col:1) + 1.
+
+!
+
 colOfX:x inVisibleLine:visLineNr
     "given a visible lineNr and x-coordinate, return colNr"
 
@@ -3872,5 +3884,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.198 1999-06-25 19:45:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.199 1999-06-26 16:29:35 cg Exp $'
 ! !