]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0139: truncating virtual text after a line not implemented v9.0.0139
authorBram Moolenaar <Bram@vim.org>
Thu, 4 Aug 2022 14:03:48 +0000 (15:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 4 Aug 2022 14:03:48 +0000 (15:03 +0100)
Problem:    Truncating virtual text after a line not implemented.
            Cursor positioning wrong with Newline in the text.
Solution:   Implement truncating.  Disallow control characters in the text.
            (closes #10842)

12 files changed:
src/charset.c
src/drawline.c
src/proto/charset.pro
src/structs.h
src/testdir/dumps/Test_prop_with_text_after_trunc_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_prop_with_text_after_trunc_2.dump [new file with mode: 0644]
src/testdir/dumps/Test_prop_with_text_after_trunc_3.dump [new file with mode: 0644]
src/testdir/dumps/Test_prop_with_text_after_trunc_4.dump [new file with mode: 0644]
src/testdir/dumps/Test_prop_with_text_after_trunc_5.dump [new file with mode: 0644]
src/testdir/dumps/Test_prop_with_text_after_wraps_1.dump [new file with mode: 0644]
src/testdir/test_textprop.vim
src/version.c

index 37c333622d307db59908e859ddab9def7a7ddd6c..7ed1fd1bd7f87c81bf18198c204559a8faa24ec9 100644 (file)
@@ -655,6 +655,9 @@ char2cells(int c)
     int
 ptr2cells(char_u *p)
 {
+    if (!has_mbyte)
+       return byte2cells(*p);
+
     // For UTF-8 we need to look at more bytes if the first byte is >= 0x80.
     if (enc_utf8 && *p >= 0x80)
        return utf_ptr2cells(p);
@@ -682,16 +685,13 @@ vim_strnsize(char_u *s, int len)
     int                size = 0;
 
     while (*s != NUL && --len >= 0)
-       if (has_mbyte)
-       {
-           int     l = (*mb_ptr2len)(s);
+    {
+       int         l = (*mb_ptr2len)(s);
 
-           size += ptr2cells(s);
-           s += l;
-           len -= l - 1;
-       }
-       else
-           size += byte2cells(*s++);
+       size += ptr2cells(s);
+       s += l;
+       len -= l - 1;
+    }
 
     return size;
 }
@@ -1026,6 +1026,40 @@ lbr_chartabsize_adv(chartabsize_T *cts)
     return retval;
 }
 
+#if defined(FEAT_PROP_POPUP) || defined(PROTO)
+/*
+ * Return the cell size of virtual text after truncation.
+ */
+    int
+textprop_size_after_trunc(
+       win_T   *wp,
+       int     below,
+       int     added,
+       char_u  *text,
+       int     *n_used_ptr)
+{
+    int        space = below ? wp->w_width : added;
+    int len = (int)STRLEN(text);
+    int strsize = 0;
+    int n_used;
+
+    // if the remaining size is to small wrap
+    // anyway and use the next line
+    if (space < PROP_TEXT_MIN_CELLS)
+       space += wp->w_width;
+    for (n_used = 0; n_used < len; n_used += (*mb_ptr2len)(text + n_used))
+    {
+       int clen = ptr2cells(text + n_used);
+
+       if (strsize + clen > space)
+           break;
+       strsize += clen;
+    }
+    *n_used_ptr = n_used;
+    return strsize;
+}
+#endif
+
 /*
  * Return the screen size of the character indicated by "cts".
  * "cts->cts_cur_text_width" is set to the extra size for a text property that
@@ -1110,16 +1144,28 @@ win_lbr_chartabsize(
            {
                char_u *p = ((char_u **)wp->w_buffer->b_textprop_text.ga_data)[
                                                               -tp->tp_id - 1];
-               int len = vim_strsize(p);
+               int     cells = vim_strsize(p);
 
+               added = wp->w_width - (vcol + size) % wp->w_width;
                if (tp->tp_col == MAXCOL)
                {
-                   // TODO: truncating
-                   if (tp->tp_flags & TP_FLAG_ALIGN_BELOW)
-                       len += wp->w_width - (vcol + size) % wp->w_width;
+                   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;
+
+                   // Keep in sync with where textprop_size_after_trunc() is
+                   // called in win_line().
+                   if (!wrap)
+                       cells = textprop_size_after_trunc(wp,
+                                                    below, added, p, &n_used);
+                   // right-aligned does not really matter here, same as
+                   // "after"
+                   if (below)
+                       cells += wp->w_width - (vcol + size) % wp->w_width;
                }
-               cts->cts_cur_text_width += len;
-               size += len;
+               cts->cts_cur_text_width += cells;
+               size += cells;
            }
            if (tp->tp_col - 1 > col)
                break;
index 4630bf03bab04e05723561324a9443dfc3084db7..d90eef9f935997865bfca10e7be873e82f5ea422 100644 (file)
@@ -1554,6 +1554,8 @@ win_line(
                                                        & TP_FLAG_ALIGN_RIGHT);
                            int     below = (text_props[used_tpi].tp_flags
                                                        & TP_FLAG_ALIGN_BELOW);
+                           int     wrap = (text_props[used_tpi].tp_flags
+                                                       & TP_FLAG_WRAP);
 
                            p_extra = p;
                            c_extra = NUL;
@@ -1566,26 +1568,53 @@ win_line(
                                // don't combine char attr after EOL
                                text_prop_combine = FALSE;
 
-                           // TODO: truncation if it doesn't fit
-                           if (right || below)
+                           // Keep in sync with where
+                           // textprop_size_after_trunc() is called in
+                           // win_lbr_chartabsize().
+                           if ((right || below || !wrap) && wp->w_width > 2)
                            {
                                int     added = wp->w_width - col;
+                               int     n_used = n_extra;
                                char_u  *l;
+                               int     strsize = wrap
+                                           ? vim_strsize(p_extra)
+                                           : textprop_size_after_trunc(wp,
+                                              below, added, p_extra, &n_used);
 
-                               // Right-align: fill with spaces
-                               if (right)
-                                   added -= vim_strsize(p_extra);
-                               if (added < 0 || (below && col == 0))
-                                   added = 0;
-                               l = alloc(n_extra + added + 1);
-                               if (l != NULL)
+                               if (wrap || right || below || n_used < n_extra)
                                {
-                                   vim_memset(l, ' ', added);
-                                   STRCPY(l + added, p);
-                                   vim_free(p_extra_free);
-                                   p_extra = p_extra_free = l;
-                                   n_extra += added;
-                                   n_attr_skip = added;
+                                   // Right-align: fill with spaces
+                                   if (right)
+                                       added -= strsize;
+                                   if (added < 0 || (below && col == 0)
+                                              || (!below && n_used < n_extra))
+                                       added = 0;
+                                   // add 1 for NUL, 2 for when '…' is used
+                                   l = alloc(n_used + added + 3);
+                                   if (l != NULL)
+                                   {
+                                       vim_memset(l, ' ', added);
+                                       vim_strncpy(l + added, p_extra, n_used);
+                                       if (n_used < n_extra)
+                                       {
+                                           char_u *lp = l + added + n_used - 1;
+
+                                           if (has_mbyte)
+                                           {
+                                               // change last character to '…'
+                                               lp -= (*mb_head_off)(l, lp);
+                                               STRCPY(lp, "…");
+                                               n_used = lp - l + 3;
+                                           }
+                                           else
+                                               // change last character to '>'
+                                               *lp = '>';
+                                       }
+                                       vim_free(p_extra_free);
+                                       p_extra = p_extra_free = l;
+                                       n_extra = n_used + added;
+                                       n_attr_skip = added;
+                                   }
                                }
                            }
                        }
@@ -1598,6 +1627,14 @@ win_line(
                        text_prop_follows = other_tpi != -1;
                    }
                }
+               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
 
index ebb548a8c49ce5dd52f7766de09e32536cd60f3a..307b3ceec93005727b8e753aeb81568e996d48bc 100644 (file)
@@ -33,6 +33,7 @@ void init_chartabsize_arg(chartabsize_T *cts, win_T *wp, linenr_T lnum, colnr_T
 void clear_chartabsize_arg(chartabsize_T *cts);
 int lbr_chartabsize(chartabsize_T *cts);
 int lbr_chartabsize_adv(chartabsize_T *cts);
+int textprop_size_after_trunc(win_T *wp, int below, int added, char_u *text, int *n_used_ptr);
 int win_lbr_chartabsize(chartabsize_T *cts, int *headp);
 void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end);
 colnr_T getvcol_nolist(pos_T *posp);
index 71114b0ce8eb199ccb41362aa11a94a364873546..e6b9f0dbef3ccd1c6ad42fcc19c12ea14a268cb5 100644 (file)
@@ -815,6 +815,8 @@ typedef struct textprop_S
 
 #define TP_FLAG_WRAP           0x40    // virtual text wraps - when missing
                                        // text is truncated
+#define PROP_TEXT_MIN_CELLS    4       // minimun number of cells to use for
+                                       // the text, even when truncating
 
 /*
  * Structure defining a property type.
diff --git a/src/testdir/dumps/Test_prop_with_text_after_trunc_1.dump b/src/testdir/dumps/Test_prop_with_text_after_trunc_1.dump
new file mode 100644 (file)
index 0000000..c8e6369
--- /dev/null
@@ -0,0 +1,9 @@
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|O|N|E| |a|n|d| |T|W|O| |a|n|d| |T|H|R|E@1| |a|n|d|…
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D|…
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| @26
+| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D| |f|i|v|e| |l|e|t|s| |w|r|a|p| |a|f|t|e|r| |s|o|…
+|c+0&#ffffff0|u|r|s|o|r| >h|e|r|e| @48
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|4|,|8| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_with_text_after_trunc_2.dump b/src/testdir/dumps/Test_prop_with_text_after_trunc_2.dump
new file mode 100644 (file)
index 0000000..c6fd499
--- /dev/null
@@ -0,0 +1,9 @@
+>o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|O|N|…||+1&#ffffff0|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v
+|o|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|o|n|…||+1&#ffffff0|e+0&&| |s|i|x| |s|e|v|e|n| +0&#ffff4012|o|n|e| |A|N|D| |t|…
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| @3||+1&&|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v
+| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D| |…||+1&#ffffff0|e+0&&| |s|i|x| |s|e|v|e|n| @10
+|c|u|r|s|o|r| |h|e|r|e| @25||+1&&| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e|…
+|~+0#4040ff13#ffffff0| @35||+1#0000000&|c+0&&|u|r|s|o|r| |h|e|r|e| @10
+|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @20
+|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |<+1&&|N|a|m|e|]| |[|+|]| |4|,|8| @4|B|o|t
+|:+0&&|3|7|v|s|p| @53
diff --git a/src/testdir/dumps/Test_prop_with_text_after_trunc_3.dump b/src/testdir/dumps/Test_prop_with_text_after_trunc_3.dump
new file mode 100644 (file)
index 0000000..5834170
--- /dev/null
@@ -0,0 +1,9 @@
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|O|N||+1&#ffffff0|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e
+|E+0&#ffff4012| |a|n|d| |T|W|O| |a|n|d| |T|H|R|E@1| |a|n|d| |F|O|U|R| |a|n|d| |F|I|…||+1&#ffffff0| +0&&|s|i|x| |s|e|v|e|n| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o|…
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e>n| +0&#ffff4012|o|n||+1&#ffffff0|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e
+|e+0&#ffff4012| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D| |f|i|…||+1&#ffffff0| +0&&|s|i|x| |s|e|v|e|n| @12
+|o|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| @2||+1&&| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1|…
+| |o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D|…||+1&#ffffff0|c+0&&|u|r|s|o|r| |h|e|r|e| @11
+|c|u|r|s|o|r| |h|e|r|e| @24||+1&&|~+0#4040ff13&| @21
+|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @4|2|,|3@1| @10|A|l@1| |<+1&&| |N|a|m|e|]| |[|+|]| |4|,|8| @4|B|o|t
+|:+0&&|3|6|w|i|n|c|m|d| ||| @48
diff --git a/src/testdir/dumps/Test_prop_with_text_after_trunc_4.dump b/src/testdir/dumps/Test_prop_with_text_after_trunc_4.dump
new file mode 100644 (file)
index 0000000..165020a
--- /dev/null
@@ -0,0 +1,9 @@
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n||+1&&|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i
+| +0&#ffff4012|O|N|E| |a|n|d| |T|W|O| |a|n|d| |T|H|R|E@1| |a|n|d| |F|O|U|R| |…||+1&#ffffff0|x+0&&| |s|e|v|e|n| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|…
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e>n||+1&&|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i
+| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |…||+1&#ffffff0|x+0&&| |s|e|v|e|n| @18
+|o|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n||+1&&| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|…
+| |o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |…||+1&#ffffff0|c+0&&|u|r|s|o|r| |h|e|r|e| @14
+|c|u|r|s|o|r| |h|e|r|e| @21||+1&&|~+0#4040ff13&| @24
+|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @3|2|,|3@1| @8|A|l@1| |<+1&&|o| |N|a|m|e|]| |[|+|]| |4|,|8| @6|B|o|t
+|:+0&&|3@1|w|i|n|c|m|d| ||| @48
diff --git a/src/testdir/dumps/Test_prop_with_text_after_trunc_5.dump b/src/testdir/dumps/Test_prop_with_text_after_trunc_5.dump
new file mode 100644 (file)
index 0000000..e134443
--- /dev/null
@@ -0,0 +1,9 @@
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r||+1&&|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|o|n|e| |A|N|…
+| +0&#ffffff0|f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|O|N||+1&#ffffff0|o+0&&|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| @7
+|E+0&#ffff4012| |a|n|d| |T|W|O| |a|n|d| |T|H|R|…||+1&#ffffff0| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D| |f|i|v|e|…
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r||+1&&|c+0&&|u|r|s|o|r| |h|e|r|e| @29
+@1|f|i|v|e| |s|i>x| |s|e|v|e|n| +0&#ffff4012|o|n||+1&#ffffff0|~+0#4040ff13&| @39
+|e+0#0000000#ffff4012| |A|N|D| |t|w|o| |A|N|D| |t|h|r|…||+1&#ffffff0|~+0#4040ff13&| @39
+|@@2| @14||+1#0000000&|~+0#4040ff13&| @39
+|<+3#0000000&|m|e|]| |[|+|]| |2|,|2|7| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @9|4|,|8| @11|B|o|t
+|:+0&&|1|8|w|i|n|c|m|d| ||| @48
diff --git a/src/testdir/dumps/Test_prop_with_text_after_wraps_1.dump b/src/testdir/dumps/Test_prop_with_text_after_wraps_1.dump
new file mode 100644 (file)
index 0000000..674ea84
--- /dev/null
@@ -0,0 +1,9 @@
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|O|N|E| |a|n|d| |T|W|O| |a|n|d| |T|H|R|E@1| |a|n|d| 
+|F|O|U|R| |a|n|d| |F|I|V|E| +0&#ffffff0@46
+|o|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| 
+|f|o|u|r| |A|N|D| |f|i|v|e| +0&#ffffff0@46
+|o|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| @26
+| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D| |f|i|v|e| |l|e|t|s| |w|r|a|p| |a|f|t|e|r| |s|o|m
+|e| |m|o|r|e| |t|e|x|t| +0&#ffffff0@48
+|c|u|r|s|o|r| >h|e|r|e| @48
+@42|4|,|8| @10|A|l@1| 
index 216ae20a41dc1fed5fd50f37a129476c18422e14..c6f6739d9d75509dc66a719c67d2bc62e4581bd9 100644 (file)
@@ -2286,6 +2286,70 @@ func Test_props_with_text_after_joined()
   call delete('XscriptPropsWithTextAfterJoined')
 endfunc
 
+func Test_props_with_text_after_truncated()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      call setline(1, ['one two three four five six seven'])
+      call prop_type_add('afterprop', #{highlight: 'Search'})
+      call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE'})
+
+      call setline(2, ['one two three four five six seven'])
+      call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right'})
+
+      call setline(3, ['one two three four five six seven'])
+      call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below'})
+
+      call setline(4, ['cursor here'])
+      normal 4Gfh
+  END
+  call writefile(lines, 'XscriptPropsWithTextAfterTrunc')
+  let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterTrunc', #{rows: 9, cols: 60})
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_1', {})
+
+  call term_sendkeys(buf, ":37vsp\<CR>gg")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_2', {})
+
+  call term_sendkeys(buf, ":36wincmd |\<CR>")
+  call term_sendkeys(buf, "2G$")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_3', {})
+
+  call term_sendkeys(buf, ":33wincmd |\<CR>")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_4', {})
+
+  call term_sendkeys(buf, ":18wincmd |\<CR>")
+  call term_sendkeys(buf, "0fx")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_5', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XscriptPropsWithTextAfterTrunc')
+endfunc
+
+func Test_props_with_text_after_wraps()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      call setline(1, ['one two three four five six seven'])
+      call prop_type_add('afterprop', #{highlight: 'Search'})
+      call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE', text_wrap: 'wrap'})
+
+      call setline(2, ['one two three four five six seven'])
+      call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right', text_wrap: 'wrap'})
+
+      call setline(3, ['one two three four five six seven'])
+      call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below', text_wrap: 'wrap'})
+
+      call setline(4, ['cursor here'])
+      normal 4Gfh
+  END
+  call writefile(lines, 'XscriptPropsWithTextAfterWraps')
+  let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterWraps', #{rows: 9, cols: 60})
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_wraps_1', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XscriptPropsWithTextAfterWraps')
+endfunc
+
 func Test_removed_prop_with_text_cleans_up_array()
   new
   call setline(1, 'some text here')
index a62fb9241198f58b5b746a206425ea5969e1fcd2..d6bd4cbedcc3b2bef5d1135f81abd49fda12e454 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    139,
 /**/
     138,
 /**/