summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-06 21:03:53 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-06 21:03:53 +0100
commitcba6952e3499f85545c274873c67bb843d3f3518 (patch)
tree706eaad538e2e5cb88380d210f3690743325a3fa
parent3f74c0ab32de7ed17dd16d9b06f5455a0bb1c297 (diff)
patch 9.0.0157: 'showbreak' displayed below truncated "after" text propv9.0.0157
Problem: 'showbreak' displayed below truncated "after" text prop. Solution: Suppress 'showbreak' when "after" prop doesn't wrap.
-rw-r--r--src/charset.c8
-rw-r--r--src/drawline.c2
-rw-r--r--src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump8
-rw-r--r--src/testdir/test_textprop.vim29
-rw-r--r--src/version.c2
5 files changed, 46 insertions, 3 deletions
diff --git a/src/charset.c b/src/charset.c
index b245bd763e..27213e93a9 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1094,6 +1094,7 @@ win_lbr_chartabsize(
int tab_corr = (*s == TAB);
int n;
char_u *sbr;
+ int no_sbr = FALSE;
#endif
#if defined(FEAT_PROP_POPUP)
@@ -1155,7 +1156,7 @@ win_lbr_chartabsize(
if (tp->tp_col == MAXCOL)
{
int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW);
- int wrap = (tp->tp_flags & TP_FLAG_WRAP);
+ int wrap = (tp->tp_flags & TP_FLAG_WRAP);
int len = (int)STRLEN(p);
int n_used = len;
@@ -1168,6 +1169,9 @@ win_lbr_chartabsize(
// "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,7 +1246,7 @@ win_lbr_chartabsize(
* Do not use 'showbreak' at the NUL after the text.
*/
added = 0;
- sbr = c == NUL ? empty_option : get_showbreak_value(wp);
+ 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;
diff --git a/src/drawline.c b/src/drawline.c
index 6024bad29c..26b52d3b17 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1722,7 +1722,7 @@ win_line(
// don't combine char attr after EOL
text_prop_flags &= ~PT_FLAG_COMBINE;
#ifdef FEAT_LINEBREAK
- if (below || right)
+ if (below || right || !wrap)
{
// no 'showbreak' before "below" text property
// or after "right" text property
diff --git a/src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump b/src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump
new file mode 100644
index 0000000000..e254ac034e
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump
@@ -0,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|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 2c59f6488d..484cb3cea4 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2336,6 +2336,35 @@ func Test_props_with_text_after()
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
diff --git a/src/version.c b/src/version.c
index 196f3e68ab..667b6071bd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 157,
+/**/
156,
/**/
155,