To: vim_dev@googlegroups.com Subject: Patch 9.0.0721 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0721 Problem: Virtual text "above" with padding not displayed correctly. Solution: Take padding into account when truncating. (closes #11340) Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_with_text_above_9.dump *** ../vim-9.0.0720/src/drawline.c 2022-10-10 21:09:40.608547492 +0100 --- src/drawline.c 2022-10-11 14:53:08.508020034 +0100 *************** *** 459,465 **** handle_breakindent(win_T *wp, winlinevars_T *wlv) { if (wp->w_briopt_sbr && wlv->draw_state == WL_BRI - 1 ! && *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) --- 459,465 ---- handle_breakindent(win_T *wp, winlinevars_T *wlv) { if (wp->w_briopt_sbr && wlv->draw_state == WL_BRI - 1 ! && *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,592 **** // 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) space -= padding; for (n_used = 0; n_used < len; n_used += (*mb_ptr2len)(text + n_used)) { --- 586,592 ---- // 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 | TP_FLAG_ALIGN_ABOVE)) space -= padding; for (n_used = 0; n_used < len; n_used += (*mb_ptr2len)(text + n_used)) { *** ../vim-9.0.0720/src/testdir/test_textprop.vim 2022-10-10 21:09:40.612547493 +0100 --- src/testdir/test_textprop.vim 2022-10-11 14:51:44.840035726 +0100 *************** *** 2852,2857 **** --- 2852,2862 ---- 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,2892 **** --- 2892,2900 ---- 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 *** ../vim-9.0.0720/src/testdir/dumps/Test_prop_with_text_above_9.dump 2022-10-11 14:54:04.448010181 +0100 --- src/testdir/dumps/Test_prop_with_text_above_9.dump 2022-10-11 14:51:51.636034403 +0100 *************** *** 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| *** ../vim-9.0.0720/src/version.c 2022-10-11 12:48:40.311207487 +0100 --- src/version.c 2022-10-11 14:54:10.636009121 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 721, /**/ -- WOMAN: Well, 'ow did you become king then? ARTHUR: The Lady of the Lake, [angels sing] her arm clad in the purest shimmering samite, held aloft Excalibur from the bosom of the water signifying by Divine Providence that I, Arthur, was to carry Excalibur. [singing stops] That is why I am your king! The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///