diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-03-07 06:45:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-03-08 10:09:22 +0800 |
commit | ec3f93ff886604f97da084681c9f0477d5b1b192 (patch) | |
tree | d5bce14822a9d98a3d0b39f6be3f0a6acc4b6f66 /src | |
parent | bcda54b30e397a5d2932730d20711bd70cdcdfa0 (diff) | |
download | rneovim-ec3f93ff886604f97da084681c9f0477d5b1b192.tar.gz rneovim-ec3f93ff886604f97da084681c9f0477d5b1b192.tar.bz2 rneovim-ec3f93ff886604f97da084681c9f0477d5b1b192.zip |
vim-patch:8.2.4520: using wrong highlight for cursor line number
Problem: Using wrong highlight for cursor line number.
Solution: Take filler lines into account when using CursorLineNr.
(closes vim/vim#9897)
https://github.com/vim/vim/commit/127969cf98000a760826ca3a0f3781a8b79522f1
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/screen.c | 6 | ||||
-rw-r--r-- | src/nvim/testdir/test_diffmode.vim | 26 |
2 files changed, 29 insertions, 3 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index ee1acd8d03..1cdee7c972 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2890,9 +2890,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc } 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) - && filler_todo == 0) { + && (row == startrow + filler_lines + || (row > startrow + filler_lines + && wp->w_p_culopt_flags & CULOPT_LINE))) { // When 'cursorline' is set highlight the line number of // the current line differently. // When 'cursorlineopt' has "screenline" only highlight diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 482d39056f..10eb979b45 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1017,6 +1017,32 @@ func Test_diff_with_cursorline() call delete('Xtest_diff_cursorline') endfunc +func Test_diff_with_cursorline_number() + CheckScreendump + + let lines =<< trim END + hi CursorLine ctermbg=red ctermfg=white + hi CursorLineNr ctermbg=white ctermfg=black cterm=underline + set cursorline number + call setline(1, ["baz", "foo", "foo", "bar"]) + 2 + vnew + call setline(1, ["foo", "foo", "bar"]) + windo diffthis + 1wincmd w + END + call writefile(lines, 'Xtest_diff_cursorline_number') + let buf = RunVimInTerminal('-S Xtest_diff_cursorline_number', {}) + + call VerifyScreenDump(buf, 'Test_diff_with_cursorline_number_01', {}) + call term_sendkeys(buf, ":set cursorlineopt=number\r") + call VerifyScreenDump(buf, 'Test_diff_with_cursorline_number_02', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_diff_cursorline_number') +endfunc + func Test_diff_with_cursorline_breakindent() CheckScreendump |