summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-29 21:37:13 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-29 21:37:13 +0000
commit7c02ad9f8906b576e53a62342c68ae557f67bacc (patch)
tree613b05d9880184456c2574df80498ddf770de36f
parentdffa6ea85c82bbcb60368f38f7437c6cd89c9e55 (diff)
patch 9.0.0975: virtual text below empty line misplaced when 'number' setv9.0.0975
Problem: Virtual text below an empty line is misplaced when 'number' is set. Solution: Adjust the computations. (closes #11629)
-rw-r--r--src/drawline.c6
-rw-r--r--src/testdir/dumps/Test_prop_below_after_empty_2.dump8
-rw-r--r--src/testdir/test_textprop.vim3
-rw-r--r--src/version.c2
4 files changed, 16 insertions, 3 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 8b19662c13..9347fda21b 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -663,9 +663,9 @@ text_prop_position(
before -= cells;
// Below-align: empty line add one character
- if (below && vcol == 0 && col_with_padding == 0
- && wp->w_width == before)
- col_with_padding = 1;
+ if (below && vcol == 0 && col_with_padding == col_off
+ && wp->w_width - col_off == before)
+ col_with_padding += 1;
if (before < 0
|| !(right || below)
diff --git a/src/testdir/dumps/Test_prop_below_after_empty_2.dump b/src/testdir/dumps/Test_prop_below_after_empty_2.dump
new file mode 100644
index 0000000000..e4c9ad2ee1
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_below_after_empty_2.dump
@@ -0,0 +1,8 @@
+| +0#af5f00255#ffffff0@1|1| >v+0#0000000&|i|m|9|s|c|r|i|p|t| @45
+| +0#af5f00255&@1|2| | +0#0000000&@55
+| +0#af5f00255&@3| +0#0000000&|T+0#ffffff16#e000002|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0#0000000#ffffff0@11
+| +0#af5f00255&@1|3| |t+0#0000000&|h|r|e@1| @50
+| +0#af5f00255&@1|4| | +0#0000000&@55
+| +0#af5f00255&@3|T+0#0000000#ffd7ff255|h|e| |s|l|o|w| |f|o|x| |b|u|m|p|s| |i|n|t|o| |t|h|e| |l|a|z|y| |d|o|g| +0&#ffffff0@19
+|~+0#4040ff13&| @58
+|:+0#0000000&|s|e|t| |n|u|m|b|e|r| @30|1|,|1| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index a6ed0af252..480c9fb752 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2744,6 +2744,9 @@ func Test_prop_with_text_below_after_empty()
let buf = RunVimInTerminal('-S XscriptPropBelowAfterEmpty', #{rows: 8, cols: 60})
call VerifyScreenDump(buf, 'Test_prop_below_after_empty_1', {})
+ call term_sendkeys(buf, ":set number\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_below_after_empty_2', {})
+
call StopVimInTerminal(buf)
endfunc
diff --git a/src/version.c b/src/version.c
index 6e206df4de..98f1cf2d0f 100644
--- 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 */
/**/
+ 975,
+/**/
974,
/**/
973,