vim-patch:8.1.2117: CursorLine highlight used while 'cursorline' is off

Problem:    CursorLine highlight used while 'cursorline' is off.
Solution:   Check 'cursorline' is set. (cloes vim/vim#5017)
49474ca122
This commit is contained in:
zeertzjq 2021-08-01 07:09:51 +08:00
parent 1666fe9dfe
commit 56b437a6c7
4 changed files with 6 additions and 6 deletions

View File

@ -2809,11 +2809,11 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
if (num_sattr != NULL) {
// :sign defined with "numhl" highlight.
char_attr = num_sattr->sat_numhl;
} else if ((wp->w_p_cul || wp->w_p_rnu)
} else if (wp->w_p_cul
&& lnum == wp->w_cursor.lnum
&& (wp->w_p_culopt_flags & CULOPT_NBR)
&& (row == startrow
|| wp->w_p_culopt_flags & CULOPT_LINE)
&& lnum == wp->w_cursor.lnum
&& filler_todo == 0) {
// When 'cursorline' is set highlight the line number of
// the current line differently.

View File

@ -52,7 +52,7 @@ func Test_cursorline_highlight1()
setl nocursorline relativenumber
redraw
let attr31 = s:screen_attr(1)
call assert_equal(attr21[0:3], attr31[0:3])
call assert_equal(attr22[0:3], attr31[0:3])
call assert_equal(attr11[4:7], attr31[4:7])
call s:close_windows()

View File

@ -1057,7 +1057,7 @@ it('diff updates line numbers below filler lines', function()
vnew
call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
windo diffthis
setlocal number rnu foldcolumn=0
setlocal number rnu cursorline cursorlineopt=number foldcolumn=0
]])
screen:expect([[
{1: }a {3:}{10:1 }^a |
@ -1109,7 +1109,7 @@ it('diff updates line numbers below filler lines', function()
{3:[No Name] [+] }{7:[No Name] [+] }|
|
]])
command("set signcolumn number tgc cursorline")
command("set signcolumn number tgc cursorline cursorlineopt=number,line")
command("hi CursorLineNr guibg=red")
screen:expect{grid=[[
{1: }a {3:}{11: 2 }a |

View File

@ -85,7 +85,7 @@ describe("folded lines", function()
end)
it("highlighting with relative line numbers", function()
command("set relativenumber foldmethod=marker")
command("set relativenumber cursorline cursorlineopt=number foldmethod=marker")
feed_command("set foldcolumn=2")
funcs.setline(1, '{{{1')
funcs.setline(2, 'line 1')