From 99c3e8cc0c037754d7487b4cb8512e40a11d6795 Mon Sep 17 00:00:00 2001 From: Matuush Date: Wed, 28 May 2025 13:16:54 +0200 Subject: [PATCH] Fix tab offset --- treap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }