summaryrefslogtreecommitdiffstats
path: root/src/drawline.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-09 15:26:03 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-09 15:26:03 +0100
commit13845c48d8ca96e0fa5bb237db519dd00045742f (patch)
tree8a676429cd49735aecc1cd69ce8de91d1e0545f2 /src/drawline.c
parentb7af5a044525b72ad607a8bf4fcfff9b9b7565df (diff)
patch 9.0.0705: virtual text truncation does not take padding into accountv9.0.0705
Problem: Virtual text truncation does not take padding into account. Solution: Subtract the padding from the available space. (closes #11318)
Diffstat (limited to 'src/drawline.c')
-rw-r--r--src/drawline.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c
index a606736211..c1565cf23a 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -573,6 +573,7 @@ textprop_size_after_trunc(
win_T *wp,
int flags, // TP_FLAG_ALIGN_*
int added,
+ int padding,
char_u *text,
int *n_used_ptr)
{
@@ -585,6 +586,8 @@ textprop_size_after_trunc(
// if the remaining size is to small wrap anyway and use the next line
if (space < PROP_TEXT_MIN_CELLS)
space += wp->w_width;
+ if (flags & TP_FLAG_ALIGN_BELOW)
+ space -= padding;
for (n_used = 0; n_used < len; n_used += (*mb_ptr2len)(text + n_used))
{
int clen = ptr2cells(text + n_used);
@@ -629,7 +632,7 @@ text_prop_position(
char_u *l = NULL;
int strsize = vim_strsize(*p_extra);
int cells = wrap ? strsize : textprop_size_after_trunc(wp,
- tp->tp_flags, before, *p_extra, &n_used);
+ tp->tp_flags, before, padding, *p_extra, &n_used);
if (wrap || right || above || below || padding > 0 || n_used < *n_extra)
{
@@ -715,7 +718,7 @@ text_prop_position(
// change last character to '…'
lp -= (*mb_head_off)(l, lp);
STRCPY(lp, "…");
- n_used = lp - l + 3 - padding;
+ n_used = lp - l + 3 - before - padding;
}
else
// change last character to '>'