diff --git a/treap.cpp b/treap.cpp index 705bf1c..4d0bc90 100644 --- a/treap.cpp +++ b/treap.cpp @@ -153,7 +153,7 @@ count_type Treap::get_tab_offset(position p) { string line = get_line(p.r, false); for(count_type i = 0; i + tab_offset < p.c; ++i) { if(line[i] == '\t') - tab_offset += ((i+tab_offset-1) % TAB_SIZE); + tab_offset += TAB_SIZE - (i+tab_offset) % TAB_SIZE - 1; if(i + tab_offset > p.c) tab_offset -= i + tab_offset - p.c; }