summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-06 19:54:13 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-06 19:54:13 +0000
commit127969cf98000a760826ca3a0f3781a8b79522f1 (patch)
tree2d5f5f7f346883705b61aa44d94d3ab3e6b8dc0b
parentd523c7be5cf39174f3447e8ec498051cea381d27 (diff)
downloadvim-git-8.2.4520.tar.gz
patch 8.2.4520: using wrong highlight for cursor line numberv8.2.4520
Problem: Using wrong highlight for cursor line number. Solution: Take filler lines into account when using CursorLineNr. (closes #9897)
-rw-r--r--src/drawline.c5
-rw-r--r--src/testdir/dumps/Test_diff_with_cursorline_number_01.dump20
-rw-r--r--src/testdir/dumps/Test_diff_with_cursorline_number_02.dump20
-rw-r--r--src/testdir/test_diffmode.vim26
-rw-r--r--src/version.c2
5 files changed, 71 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c
index a55c06dc9..6a5c28df1 100644
--- 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
index 000000000..82892105e
--- /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
index 000000000..028441c5e
--- /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
index c626023b4..a632b19bc 100644
--- 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
index 800b8fc55..9753167ad 100644
--- 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,