To: vim_dev@googlegroups.com Subject: Patch 9.0.0157 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0157 Problem: 'showbreak' displayed below truncated "after" text prop. Solution: Suppress 'showbreak' when "after" prop doesn't wrap. Files: src/drawline.c, src/charset.c, src/testdir/test_textprop.vim src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump *** ../vim-9.0.0156/src/drawline.c 2022-08-06 17:38:47.120785704 +0100 --- src/drawline.c 2022-08-06 21:02:37.982653209 +0100 *************** *** 1722,1728 **** // don't combine char attr after EOL text_prop_flags &= ~PT_FLAG_COMBINE; #ifdef FEAT_LINEBREAK ! if (below || right) { // no 'showbreak' before "below" text property // or after "right" text property --- 1722,1728 ---- // don't combine char attr after EOL text_prop_flags &= ~PT_FLAG_COMBINE; #ifdef FEAT_LINEBREAK ! if (below || right || !wrap) { // no 'showbreak' before "below" text property // or after "right" text property *** ../vim-9.0.0156/src/charset.c 2022-08-05 20:25:46.666888629 +0100 --- src/charset.c 2022-08-06 21:03:03.034657907 +0100 *************** *** 1094,1099 **** --- 1094,1100 ---- int tab_corr = (*s == TAB); int n; char_u *sbr; + int no_sbr = FALSE; #endif #if defined(FEAT_PROP_POPUP) *************** *** 1155,1161 **** if (tp->tp_col == MAXCOL) { int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW); ! int wrap = (tp->tp_flags & TP_FLAG_WRAP); int len = (int)STRLEN(p); int n_used = len; --- 1156,1162 ---- if (tp->tp_col == MAXCOL) { int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW); ! int wrap = (tp->tp_flags & TP_FLAG_WRAP); int len = (int)STRLEN(p); int n_used = len; *************** *** 1168,1173 **** --- 1169,1177 ---- // "after" if (below) cells += wp->w_width - (vcol + size) % wp->w_width; + #ifdef FEAT_LINEBREAK + no_sbr = TRUE; // don't use 'showbreak' now + #endif } cts->cts_cur_text_width += cells; size += cells; *************** *** 1242,1248 **** * Do not use 'showbreak' at the NUL after the text. */ added = 0; ! sbr = c == NUL ? empty_option : get_showbreak_value(wp); if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && vcol != 0) { colnr_T sbrlen = 0; --- 1246,1252 ---- * Do not use 'showbreak' at the NUL after the text. */ added = 0; ! sbr = (c == NUL || no_sbr) ? empty_option : get_showbreak_value(wp); if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && vcol != 0) { colnr_T sbrlen = 0; *** ../vim-9.0.0156/src/testdir/test_textprop.vim 2022-08-06 17:38:47.120785704 +0100 --- src/testdir/test_textprop.vim 2022-08-06 21:01:25.662636728 +0100 *************** *** 2336,2341 **** --- 2336,2370 ---- call delete('XscriptPropsWithTextAfter') endfunc + func Test_props_with_text_after_below_trunc() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + edit foobar + set showbreak=+++ + setline(1, ['onasdf 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, 'XscriptPropsAfterTrunc') + let buf = RunVimInTerminal('-S XscriptPropsAfterTrunc', #{rows: 8, cols: 60}) + call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_1', {}) + + call StopVimInTerminal(buf) + call delete('XscriptPropsAfterTrunc') + endfunc + func Test_props_with_text_after_joined() CheckRunVimInTerminal *** ../vim-9.0.0156/src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump 2022-08-06 21:03:17.926660469 +0100 --- src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump 2022-08-06 21:01:29.582637738 +0100 *************** *** 0 **** --- 1,8 ---- + |o+0&#ffffff0|n|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|… + |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 + |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.0156/src/version.c 2022-08-06 18:12:02.966750593 +0100 --- src/version.c 2022-08-06 20:36:47.466841838 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 157, /**/ -- hundred-and-one symptoms of being an internet addict: 260. Co-workers have to E-mail you about the fire alarm to get you out of the building. /// 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 ///