Skip to content

Commit

Permalink
Add test column fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rbong committed Sep 25, 2024
1 parent d1a0fb7 commit c881729
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions autoload/flog/test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,28 @@ endfunction
function! flog#test#ShowNvimBufHl() abort
" Get all highlight group extmarks
let l:line_hl_groups = {}
let l:col_fix = v:null
for [l:id, l:row, l:start_col, l:details] in nvim_buf_get_extmarks(
\ 0, -1, 0, -1, { 'details': 1, 'type': 'highlight' })
if !has_key(l:line_hl_groups, l:row)
let l:line_hl_groups[l:row] = {}
endif
let l:hl_groups = l:line_hl_groups[l:row]

" Fix bug in old versions of Neovim where start_col is off by one
if l:col_fix == v:null
let l:col_fix = l:start_virtcol > 0
endif
if l:col_fix
let l:start_col -= 1
endif

let l:start_virtcol = virtcol([l:row + 1, l:start_col])
let l:end_virtcol = virtcol([l:row + 1, l:details.end_col]) - 1

if l:end_virtcol >= l:start_virtcol
for l:virtcol in range(l:start_virtcol, l:end_virtcol)
let l:hl_groups[l:virtcol] = l:details.hl_group
endfor
endif
for l:virtcol in range(l:start_virtcol, l:end_virtcol)
let l:hl_groups[l:virtcol] = l:details.hl_group
endfor
endfor

" Build output
Expand Down

0 comments on commit c881729

Please sign in to comment.