-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
6
-
generic
-
generic
LineTabMapImpl.getPosition() in b99 is implmented as follows:
public int getPosition(int line, int column) {
int pos = startPosition[line - FIRSTLINE];
column -= FIRSTCOLUMN;
int col = 0;
while (col < column) {
pos++;
if (tabMap.get(pos))
col = (col / TabInc * TabInc) + TabInc;
else
col++;
}
return pos;
}
but it should be:
public int getPosition(int line, int column) {
int pos = startPosition[line - FIRSTLINE];
column -= FIRSTCOLUMN;
int col = 0;
while (col < column) {
if (tabMap.get(pos++))
col = (col / TabInc * TabInc) + TabInc;
else
col++;
}
return pos;
}
notice that the current code invokes tabMap.get() with a wrong index.
public int getPosition(int line, int column) {
int pos = startPosition[line - FIRSTLINE];
column -= FIRSTCOLUMN;
int col = 0;
while (col < column) {
pos++;
if (tabMap.get(pos))
col = (col / TabInc * TabInc) + TabInc;
else
col++;
}
return pos;
}
but it should be:
public int getPosition(int line, int column) {
int pos = startPosition[line - FIRSTLINE];
column -= FIRSTCOLUMN;
int col = 0;
while (col < column) {
if (tabMap.get(pos++))
col = (col / TabInc * TabInc) + TabInc;
else
col++;
}
return pos;
}
notice that the current code invokes tabMap.get() with a wrong index.