Skip to content

Commit d3e830a

Browse files
committed
Do not highlight next line col 1 in wrapped group
Fixes #751
1 parent cafd80b commit d3e830a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

autoload/OmniSharp/actions/highlight.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,17 @@ function! s:HighlightRH(bufnr, buftick, response) abort
6969
let endCol = OmniSharp#util#CharToByteIdx(
7070
\ a:bufnr, span.EndLine, span.EndColumn)
7171
if !hasNvim
72+
let endLine = span.EndLine
73+
if endCol == 1 && endLine > span.StartLine
74+
" When a span runs to the end of the line, OmniSharp-roslyn returns
75+
" this span as ending at character 1 of the following line. However,
76+
" Vim will then display this highlight on the first character of the
77+
" line, which is incorrect.
78+
let endLine = endLine - 1
79+
let endCol = 9999
80+
endif
7281
call prop_add(span.StartLine, startCol, {
73-
\ 'end_lnum': span.EndLine,
82+
\ 'end_lnum': endLine,
7483
\ 'end_col': endCol,
7584
\ 'type': 'OSHighlight' . shc.name,
7685
\ 'bufnr': a:bufnr

0 commit comments

Comments
 (0)