To: vim_dev@googlegroups.com Subject: Patch 9.0.0158 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0158 Problem: With 'nowrap' "below" property not displayed correctly. Solution: Adjust virtual text with 'nowrap', do not truncate. Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_with_text_below_nowrap_1.dump, src/testdir/dumps/Test_prop_with_text_below_nowrap_2.dump *** ../vim-9.0.0157/src/drawline.c 2022-08-06 21:03:32.922662885 +0100 --- src/drawline.c 2022-08-06 21:54:53.473442628 +0100 *************** *** 1642,1650 **** --bcol; # endif // Add any text property that starts in this column. while (text_prop_next < text_prop_count && (text_props[text_prop_next].tp_col == MAXCOL ! ? *ptr == NUL : bcol >= text_props[text_prop_next].tp_col - 1)) { if (bcol <= text_props[text_prop_next].tp_col - 1 --- 1642,1656 ---- --bcol; # endif // Add any text property that starts in this column. + // With 'nowrap' and not in the first screen line only "below" + // text prop can show. while (text_prop_next < text_prop_count && (text_props[text_prop_next].tp_col == MAXCOL ! ? (*ptr == NUL ! && (wp->w_p_wrap ! || wlv.row == startrow ! || (text_props[text_prop_next].tp_flags ! & TP_FLAG_ALIGN_BELOW))) : bcol >= text_props[text_prop_next].tp_col - 1)) { if (bcol <= text_props[text_prop_next].tp_col - 1 *************** *** 1761,1767 **** vim_memset(l, ' ', added); vim_strncpy(l + added, wlv.p_extra, n_used); ! if (n_used < wlv.n_extra) { char_u *lp = l + added + n_used - 1; --- 1767,1774 ---- vim_memset(l, ' ', added); vim_strncpy(l + added, wlv.p_extra, n_used); ! if (n_used < wlv.n_extra ! && wp->w_p_wrap) { char_u *lp = l + added + n_used - 1; *************** *** 1810,1820 **** } else if (text_prop_next < text_prop_count && text_props[text_prop_next].tp_col == MAXCOL ! && *ptr != NUL ! && ptr[mb_ptr2len(ptr)] == NUL) // When at last-but-one character and a text property // follows after it, we may need to flush the line after // displaying that character. text_prop_follows = TRUE; } #endif --- 1817,1831 ---- } else if (text_prop_next < text_prop_count && text_props[text_prop_next].tp_col == MAXCOL ! && ((*ptr != NUL && ptr[mb_ptr2len(ptr)] == NUL) ! || (!wp->w_p_wrap ! && wlv.col == wp->w_width - 1 ! && (text_props[text_prop_next].tp_flags ! & TP_FLAG_ALIGN_BELOW)))) // When at last-but-one character and a text property // follows after it, we may need to flush the line after // displaying that character. + // Or when not wrapping and at the rightmost column. text_prop_follows = TRUE; } #endif *************** *** 3461,3466 **** --- 3472,3487 ---- #endif ) || lcs_eol_one == -1) break; + #ifdef FEAT_PROP_POPUP + if (!wp->w_p_wrap) + { + // do not output more of the line, only the "below" prop + ptr += STRLEN(ptr); + # ifdef FEAT_LINEBREAK + dont_use_showbreak = TRUE; + # endif + } + #endif // When the window is too narrow draw all "@" lines. if (wlv.draw_state != WL_LINE *** ../vim-9.0.0157/src/testdir/test_textprop.vim 2022-08-06 21:03:32.922662885 +0100 --- src/testdir/test_textprop.vim 2022-08-06 22:00:46.884164443 +0100 *************** *** 2482,2487 **** --- 2482,2520 ---- call delete('XscriptPropsAfterNowrap') endfunc + func Test_props_with_text_below_nowrap() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + edit foobar + set nowrap + set showbreak=+++\ + setline(1, ['onasdf asdf asdf sdf df asdf asdf e asdf asdf asdf asdf asd fas df', 'two']) + prop_type_add('test', {highlight: 'Special'}) + prop_add(1, 0, { + type: 'test', + text: 'the quick brown fox jumps over the lazy dog', + text_align: 'after' + }) + prop_add(1, 0, { + type: 'test', + text: 'the quick brown fox jumps over the lazy dog', + text_align: 'below' + }) + normal G$ + END + call writefile(lines, 'XscriptPropsBelowNowrap') + let buf = RunVimInTerminal('-S XscriptPropsBelowNowrap', #{rows: 8, cols: 60}) + call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_1', {}) + + call term_sendkeys(buf, "gg$") + call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_2', {}) + + call StopVimInTerminal(buf) + call delete('XscriptPropsBelowNowrap') + endfunc + func Test_props_with_text_after_split_join() CheckRunVimInTerminal *** ../vim-9.0.0157/src/testdir/dumps/Test_prop_with_text_below_nowrap_1.dump 2022-08-06 22:02:49.167819375 +0100 --- src/testdir/dumps/Test_prop_with_text_below_nowrap_1.dump 2022-08-06 22:00:51.908149500 +0100 *************** *** 0 **** --- 1,8 ---- + |o+0&#ffffff0|n|a|s|d|f| |a|s|d|f| |a|s|d|f| |s|d|f| |d|f| |a|s|d|f| |a|s|d|f| |e| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d| + |t+0#e000e06&|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&@16 + |t|w>o| @56 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |~| @58 + |"+0#0000000&|f|o@1|b|a|r|"| |[|N|e|w|]| @27|2|,|3| @10|A|l@1| *** ../vim-9.0.0157/src/testdir/dumps/Test_prop_with_text_below_nowrap_2.dump 2022-08-06 22:02:49.171819364 +0100 --- src/testdir/dumps/Test_prop_with_text_below_nowrap_2.dump 2022-08-06 22:00:53.060146084 +0100 *************** *** 0 **** --- 1,8 ---- + | +0&#ffffff0|a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d| |f|a|s| |d>f|t+0#e000e06&|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e + |t|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&@16 + @60 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |~| @58 + |"+0#0000000&|f|o@1|b|a|r|"| |[|N|e|w|]| @27|1|,|6@1| @9|A|l@1| *** ../vim-9.0.0157/src/version.c 2022-08-06 21:03:32.922662885 +0100 --- src/version.c 2022-08-06 21:57:20.064850289 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 158, /**/ -- hundred-and-one symptoms of being an internet addict: 261. You find diskettes in your pockets when doing laundry. /// 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 ///