diff --git a/autoload/flog/test.vim b/autoload/flog/test.vim index c61d938..1bbbf9f 100644 --- a/autoload/flog/test.vim +++ b/autoload/flog/test.vim @@ -11,6 +11,7 @@ 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) @@ -18,14 +19,20 @@ function! flog#test#ShowNvimBufHl() abort 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