# HG changeset patch # User Bram Moolenaar # Date 1646596806 -3600 # Node ID 27ae8ea82d7ab9e0e4f8f894394dad7fd6344a5a # Parent f205245245253f7c56c289cbde38a321f5e38fbd patch 8.2.4520: using wrong highlight for cursor line number Commit: https://github.com/vim/vim/commit/127969cf98000a760826ca3a0f3781a8b79522f1 Author: Bram Moolenaar Date: Sun Mar 6 19:54:13 2022 +0000 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 #9897) diff --git a/src/drawline.c b/src/drawline.c --- a/src/drawline.c +++ b/src/drawline.c @@ -1194,8 +1194,9 @@ win_line( 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)) + && (row == startrow + filler_lines + || (row > startrow + filler_lines + && wp->w_p_culopt_flags & CULOPT_LINE))) char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN)); #endif if (wp->w_p_rnu && lnum < wp->w_cursor.lnum diff --git a/src/testdir/dumps/Test_diff_with_cursorline_number_01.dump b/src/testdir/dumps/Test_diff_with_cursorline_number_01.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_diff_with_cursorline_number_01.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|-+0#4040ff13#afffff255@30||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |b+0#0000000#5fd7ff255|a|z| @27 +| +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|1| >f+8#ffffff16#ff404010|o@1| @27||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|2| |f+8#ffffff16#ff404010|o@1| @27 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |f+0#0000000&|o@1| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|o@1| @27 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |b+0#0000000&|a|r| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|4| |b+0#0000000&|a|r| @27 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|1| @11|A|l@1 +| +0&&@74 diff --git a/src/testdir/dumps/Test_diff_with_cursorline_number_02.dump b/src/testdir/dumps/Test_diff_with_cursorline_number_02.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_diff_with_cursorline_number_02.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|-+0#4040ff13#afffff255@30||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |b+0#0000000#5fd7ff255|a|z| @27 +| +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|1| >f+0#0000000#ffffff0|o@1| @27||+1&&| +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|2| |f+8#ffffff16#ff404010|o@1| @27 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |f+0#0000000&|o@1| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|o@1| @27 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |b+0#0000000&|a|r| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|4| |b+0#0000000&|a|r| @27 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|1| @11|A|l@1 +|:+0&&|s|e|t| |c|u|r|s|o|r|l|i|n|e|o|p|t|=|n|u|m|b|e|r| @49 diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -1056,6 +1056,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 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4520, +/**/ 4519, /**/ 4518,