Skip to content

Commit 4616117

Browse files
committed
Bug fix in lookup_byte_offset.
1 parent da74a7f commit 4616117

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/comp/syntax/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn lookup_byte_offset(cm: codemap::codemap, chpos: uint)
143143
{
144144
fn lookup(pos: file_pos) -> uint { ret pos.ch; }
145145
let {fm,line} = option::get(lookup_line(cm,chpos,lookup));
146-
let line_offset = fm.lines[line].byte;
146+
let line_offset = fm.lines[line].byte - fm.start_pos.byte;
147147
let col = chpos - fm.lines[line].ch;
148148
let col_offset = str::byte_len_range(*fm.src, line_offset, col);
149149
ret {fm: fm, pos: line_offset + col_offset};

0 commit comments

Comments
 (0)