To: vim_dev@googlegroups.com Subject: Patch 9.0.0518 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0518 Problem: Virtual text highlight starts too early with 'nowrap' and 'number' set. Solution: Add the offset to the attribute skip count. (issue #11138) Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_below_split_line_3.dump *** ../vim-9.0.0517/src/drawline.c 2022-09-20 16:15:25.804584428 +0100 --- src/drawline.c 2022-09-20 17:52:26.419826163 +0100 *************** *** 335,341 **** int padding = tp->tp_col == MAXCOL && tp->tp_len > 1 ? tp->tp_len - 1 : 0; int col_with_padding = vcol + (below ? 0 : padding); - int col_off = 0; int room = wp->w_width - col_with_padding; int before = room; // spaces before the text int after = 0; // spaces after the text --- 335,340 ---- *************** *** 347,352 **** --- 346,354 ---- if (wrap || right || above || below || padding > 0 || n_used < *n_extra) { + int col_off = win_col_off(wp) + win_col_off2(wp); + int skip_add = 0; + if (above) { before = 0; *************** *** 366,384 **** if (right && (wrap || room < PROP_TEXT_MIN_CELLS)) { // right-align on next line instead of wrapping if possible - col_off = win_col_off(wp) + win_col_off2(wp); before = wp->w_width - col_off - strsize + room; if (before < 0) before = 0; else n_used = *n_extra; } else before = 0; } else if (below && before > 0) // include 'number' column et al. ! col_off = win_col_off(wp) + win_col_off2(wp); } // With 'nowrap' add one to show the "extends" character if needed (it --- 368,386 ---- if (right && (wrap || room < PROP_TEXT_MIN_CELLS)) { // right-align on next line instead of wrapping if possible before = wp->w_width - col_off - strsize + room; if (before < 0) before = 0; else n_used = *n_extra; + skip_add = col_off; } else before = 0; } else if (below && before > 0) // include 'number' column et al. ! skip_add = col_off; } // With 'nowrap' add one to show the "extends" character if needed (it *************** *** 388,393 **** --- 390,397 ---- && wp->w_lcs_chars.ext != NUL && wp->w_p_list) ++n_used; + if (!wp->w_p_wrap && below && padding > 0) + skip_add = col_off; // add 1 for NUL, 2 for when '…' is used if (n_attr != NULL) *************** *** 441,447 **** *n_attr = mb_charlen(*p_extra); if (above) *n_attr -= padding + after; ! *n_attr_skip = before + padding + col_off; } } } --- 445,451 ---- *n_attr = mb_charlen(*p_extra); if (above) *n_attr -= padding + after; ! *n_attr_skip = before + padding + skip_add; } } } *** ../vim-9.0.0517/src/testdir/test_textprop.vim 2022-09-20 15:59:00.458848144 +0100 --- src/testdir/test_textprop.vim 2022-09-20 17:49:23.452360364 +0100 *************** *** 2925,2930 **** --- 2925,2933 ---- call term_sendkeys(buf, "\:set number\") call VerifyScreenDump(buf, 'Test_prop_below_split_line_2', {}) + call term_sendkeys(buf, ":set nowrap\") + call VerifyScreenDump(buf, 'Test_prop_below_split_line_3', {}) + call StopVimInTerminal(buf) endfunc *** ../vim-9.0.0517/src/testdir/dumps/Test_prop_below_split_line_3.dump 2022-09-20 17:57:23.027014128 +0100 --- src/testdir/dumps/Test_prop_below_split_line_3.dump 2022-09-20 17:52:32.823808013 +0100 *************** *** 0 **** --- 1,8 ---- + | +0#af5f00255#ffffff0@1|1| |o+0#0000000&|n|e| |o|n|e| |o|n|e| @59 + | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |t|w|o| |t|w|o| @59 + | +0#af5f00255&@3| +0#0000000&@2|└+0&#ffff4012|─| |V|i|r|t|u|a|l| |t|e|x|t| |b|e|l|o|w| |t|h|e| |2|n|d| |l|i|n|e| +0&#ffffff0@33 + | +0#af5f00255&@1|3| |x+0#0000000&>x| @68 + | +0#af5f00255&@1|4| |t+0#0000000&|h|r|e@1| |t|h|r|e@1| |t|h|r|e@1| @53 + |~+0#4040ff13&| @73 + |~| @73 + |:+0#0000000&|s|e|t| |n|o|w|r|a|p| @45|3|,|2| @10|A|l@1| *** ../vim-9.0.0517/src/version.c 2022-09-20 17:11:43.589765767 +0100 --- src/version.c 2022-09-20 17:55:43.023282170 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 518, /**/ -- "New York, the city that never sleeps". "There is so much noise?" /// 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 ///