public int position(int pos) { int n = lines; for (LineList p = list; p != null; p = p.tail, n--) { if (p.head < pos) { return(p.getpos(pos)); } } return(pos + 1); // H Houh 4.3d }
public SourceLineInfo(LineManager lm, int pos) { lineNumber = lm.lines; startOfLine = 0; endOfLine = lm.end; charPosition = pos; rawCharPosition = pos; for (LineList p = lm.list; p != null; p = p.tail, lineNumber--) { if (p.head > pos) { endOfLine = p.head; } else { startOfLine = p.head + 1; rawCharPosition = p.getpos(pos); charPosition = pos - startOfLine + 1; break; } } }