# HG changeset patch # User Bram Moolenaar # Date 1665496805 -7200 # Node ID fc9993c5835afa53cfeb5577a46a8b8121dd51e5 # Parent 73a1f2dec98913d812596688ccc5355a6ba44cb3 patch 9.0.0721: virtual text "above" with padding not displayed correctly Commit: https://github.com/vim/vim/commit/9466fb8001227a4bc9045e91045426bc40680366 Author: Bram Moolenaar Date: Tue Oct 11 14:54:42 2022 +0100 patch 9.0.0721: virtual text "above" with padding not displayed correctly Problem: Virtual text "above" with padding not displayed correctly. Solution: Take padding into account when truncating. (closes https://github.com/vim/vim/issues/11340) diff --git a/src/drawline.c b/src/drawline.c --- 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 --- /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 --- 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, "\ls\\") call VerifyScreenDump(buf, 'Test_prop_with_text_above_8', {}) + call term_sendkeys(buf, ":call AddLongPropAbove()\") + call VerifyScreenDump(buf, 'Test_prop_with_text_above_9', {}) + call StopVimInTerminal(buf) endfunc diff --git a/src/version.c b/src/version.c --- 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,