Skip to content

Commit

Permalink
Fix off-by-one conceal column
Browse files Browse the repository at this point in the history
  • Loading branch information
rbong committed Sep 3, 2024
1 parent 956e120 commit dad7790
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions autoload/flog/win.vim
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ function! flog#win#GetCols(lnum, target_col, target_concealcol) abort
let l:virtcol = 1
let l:concealcol = 1
let l:conceal_region = -1
let l:conceal_width = -1

let l:end_col = col([a:lnum, '$'])

while l:col <= l:end_col
let [l:is_concealed, l:conceal_ch, l:new_conceal_region] = synconcealed(a:lnum, l:col)
let l:conceal_width = l:is_concealed ? strwidth(l:conceal_ch) : -1

if a:target_col >= 0 && a:target_col <= l:col && l:conceal_width != 0
break
endif
Expand All @@ -78,18 +79,15 @@ function! flog#win#GetCols(lnum, target_col, target_concealcol) abort
break
endif

let [l:is_concealed, l:conceal_ch, l:new_conceal_region] = synconcealed(a:lnum, l:col + 1)
let l:col += l:width
let l:virtcol += 1

if !l:is_concealed
let l:concealcol += 1
let l:conceal_region = -1
let l:conceal_width = -1
let l:concealcol += 1
elseif l:new_conceal_region != l:conceal_region
let l:conceal_width = strwidth(l:conceal_ch)
let l:concealcol += l:conceal_width
let l:conceal_region = l:new_conceal_region
let l:concealcol += l:conceal_width
endif
endwhile

Expand Down

0 comments on commit dad7790

Please sign in to comment.