]> granicus.if.org Git - vim/commitdiff
patch 9.0.1326: relative line number not updated with virtual text above v9.0.1326
authorBram Moolenaar <Bram@vim.org>
Sun, 19 Feb 2023 14:34:37 +0000 (14:34 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 19 Feb 2023 14:34:37 +0000 (14:34 +0000)
Problem:    Relative line number not updated with virtual text above.
Solution:   Adjust the row for the line number for virtual text above.
            (closes #12004)

src/drawline.c
src/testdir/dumps/Test_prop_above_below_empty_4.dump [new file with mode: 0644]
src/testdir/dumps/Test_prop_above_below_empty_5.dump [new file with mode: 0644]
src/testdir/test_textprop.vim
src/version.c

index 74c736c24dd98ebe395b621a6f97ff53b28d759c..5fe25f554f4a43240777e0c3ff5ea7d653fdabf0 100644 (file)
@@ -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
diff --git a/src/testdir/dumps/Test_prop_above_below_empty_4.dump b/src/testdir/dumps/Test_prop_above_below_empty_4.dump
new file mode 100644 (file)
index 0000000..cc3c27d
--- /dev/null
@@ -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| 
diff --git a/src/testdir/dumps/Test_prop_above_below_empty_5.dump b/src/testdir/dumps/Test_prop_above_below_empty_5.dump
new file mode 100644 (file)
index 0000000..5ee4d80
--- /dev/null
@@ -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| 
index 158896f612de2377c22fff7b2268c4e6017846a7..3bd08fe4d71da1afc5c47611b1b3861ed131ae74 100644 (file)
@@ -2806,6 +2806,14 @@ func Test_prop_with_text_above_below_empty()
   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
 
index 10b38d44accda8490f550e0bcabac0ded353cb62..53452bfbe76d4bb8b8e1f40c13012b9aec464cf7 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1326,
 /**/
     1325,
 /**/