summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-11 14:54:42 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-11 14:54:42 +0100
commit9466fb8001227a4bc9045e91045426bc40680366 (patch)
treecd7d96d07d6a27a2072975a5e07310c9acb82365
parent0c502d2e7031611788c301c7da0896f0fd9515fd (diff)
patch 9.0.0721: virtual text "above" with padding not displayed correctlyv9.0.0721
Problem: Virtual text "above" with padding not displayed correctly. Solution: Take padding into account when truncating. (closes #11340)
-rw-r--r--src/drawline.c4
-rw-r--r--src/testdir/dumps/Test_prop_with_text_above_9.dump9
-rw-r--r--src/testdir/test_textprop.vim8
-rw-r--r--src/version.c2
4 files changed, 21 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c
index bc1b20a19f..b71bedefab 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -459,7 +459,7 @@ handle_lnum_col(
handle_breakindent(win_T *wp, winlinevars_T *wlv)
{
if (wp->w_briopt_sbr && wlv->draw_state == WL_BRI - 1
- && *get_showbreak_value(wp) != NUL)
+ && *get_showbreak_value(wp) != NUL)
// draw indent after showbreak value
wlv->draw_state = WL_BRI;
else if (wp->w_briopt_sbr && wlv->draw_state == WL_SBR)
@@ -586,7 +586,7 @@ textprop_size_after_trunc(
// if the remaining size is to small wrap anyway and use the next line
if (space < PROP_TEXT_MIN_CELLS)
space += wp->w_width;
- if (flags & TP_FLAG_ALIGN_BELOW)
+ if (flags & (TP_FLAG_ALIGN_BELOW | TP_FLAG_ALIGN_ABOVE))
space -= padding;
for (n_used = 0; n_used < len; n_used += (*mb_ptr2len)(text + n_used))
{
diff --git a/src/testdir/dumps/Test_prop_with_text_above_9.dump b/src/testdir/dumps/Test_prop_with_text_above_9.dump
new file mode 100644
index 0000000000..727f859b43
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_above_9.dump
@@ -0,0 +1,9 @@
+| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36
+| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35
+| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3| +0#0000000&@1|0+0&#ffff4012| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|…
+| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |i+0#0000000&|n|s|e|r|t|e|d| @45
+| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| >o+0#0000000&|n|e| |t|w|o| @46
+| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0&#ffffff0@48
+|~+0#4040ff13&| @58
+|~| @58
+|:+0#0000000&|c|a|l@1| |A|d@1|L|o|n|g|P|r|o|p|A|b|o|v|e|(|)| @17|2|,|1| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 3fb27c9a6f..b270b6ca5e 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2852,6 +2852,11 @@ func Test_props_with_text_above()
func AddPropBelow()
call prop_add(1, 0, #{type: 'below', text: 'below', text_align: 'below'})
endfunc
+ func AddLongPropAbove()
+ 3,4delete
+ set wrap
+ call prop_add(1, 0, #{type: 'above1', text: range(50)->join(' '), text_align: 'above', text_padding_left: 2})
+ endfunc
END
call writefile(lines, 'XscriptPropsWithTextAbove', 'D')
let buf = RunVimInTerminal('-S XscriptPropsWithTextAbove', #{rows: 9, cols: 60})
@@ -2887,6 +2892,9 @@ func Test_props_with_text_above()
call term_sendkeys(buf, "\<Esc>ls\<CR>\<Esc>")
call VerifyScreenDump(buf, 'Test_prop_with_text_above_8', {})
+ call term_sendkeys(buf, ":call AddLongPropAbove()\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_with_text_above_9', {})
+
call StopVimInTerminal(buf)
endfunc
diff --git a/src/version.c b/src/version.c
index 87259de51e..86bec6c581 100644
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 721,
+/**/
720,
/**/
719,