changeset 31988:a7801ecf7df9 v9.0.1326

patch 9.0.1326: relative line number not updated with virtual text above Commit: https://github.com/vim/vim/commit/a572b936ce7bbaf630b22a32c039738a783cdf41 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 19 14:34:37 2023 +0000 patch 9.0.1326: relative line number not updated with virtual text above Problem: Relative line number not updated with virtual text above. Solution: Adjust the row for the line number for virtual text above. (closes #12004)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Feb 2023 15:45:03 +0100
parents 86e4e74f473c
children bfb00817db23
files src/drawline.c src/testdir/dumps/Test_prop_above_below_empty_4.dump src/testdir/dumps/Test_prop_above_below_empty_5.dump src/testdir/test_textprop.vim src/version.c
diffstat 5 files changed, 51 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1598,6 +1598,15 @@ win_line(
 		}
 	}
     }
+
+    if (number_only)
+    {
+	// skip over rows only used for virtual text above
+	wlv.row += wlv.text_prop_above_count;
+	if (wlv.row > endrow)
+	    return wlv.row;
+	wlv.screen_row += wlv.text_prop_above_count;
+    }
 #endif
 
     // 'nowrap' or 'wrap' and a single line that doesn't fit: Advance to the
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_above_below_empty_4.dump
@@ -0,0 +1,16 @@
+| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|4| |1+0#0000000&@7| @47
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|3| | +0#0000000&@55
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|2| |3+0#0000000&@8| @46
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|1| | +0#0000000&@55
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+|5+0#af5f00255&| @2>5+0#0000000&@10| @44
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+|:| @40|5|,|1|-|5|7| @7|A|l@1| 
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_above_below_empty_5.dump
@@ -0,0 +1,16 @@
+| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|2| |1+0#0000000&@7| @47
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|1| | +0#0000000&@55
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+|3+0#af5f00255&| @2>3+0#0000000&@8| @46
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|1| | +0#0000000&@55
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|2| |5+0#0000000&@10| @44
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+|:| @40|3|,|1|-|5|7| @7|A|l@1| 
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2806,6 +2806,14 @@ func Test_prop_with_text_above_below_emp
   call term_sendkeys(buf, ":\<CR>")
   call VerifyScreenDump(buf, 'Test_prop_above_below_empty_3', {})
 
+  call term_sendkeys(buf, ":set colorcolumn=\<CR>")
+  call term_sendkeys(buf, ":set relativenumber\<CR>")
+  call term_sendkeys(buf, ":\<CR>")
+  call VerifyScreenDump(buf, 'Test_prop_above_below_empty_4', {})
+
+  call term_sendkeys(buf, "kk")
+  call VerifyScreenDump(buf, 'Test_prop_above_below_empty_5', {})
+
   call StopVimInTerminal(buf)
 endfunc
 
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1326,
+/**/
     1325,
 /**/
     1324,