summaryrefslogtreecommitdiffstats
path: root/src/textprop.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-01 16:11:06 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-01 16:11:06 +0100
commit783ef7214b6a33300bd83f616c1ead587370ce49 (patch)
tree000e03daade5825f8b2ef465690f8dea766f39cc /src/textprop.c
parent1f4ee19eefecd8f70b7cbe8ee9db8ace6352e23e (diff)
patch 9.0.0131: virtual text with Tab is not displayed correctlyv9.0.0131
Problem: Virtual text with Tab is not displayed correctly. Solution: Change any Tab to a space.
Diffstat (limited to 'src/textprop.c')
-rw-r--r--src/textprop.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/textprop.c b/src/textprop.c
index f544a3ce5a..6fefc6d24c 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -226,7 +226,8 @@ prop_add_one(
if (text != NULL)
{
- garray_T *gap = &buf->b_textprop_text;
+ garray_T *gap = &buf->b_textprop_text;
+ char_u *p;
// double check we got the right ID
if (-id - 1 != gap->ga_len)
@@ -236,6 +237,11 @@ prop_add_one(
if (ga_grow(gap, 1) == FAIL)
goto theend;
((char_u **)gap->ga_data)[gap->ga_len++] = text;
+
+ // change any Tab to a Space to make it simpler to compute the size
+ for (p = text; *p != NUL; MB_PTR_ADV(p))
+ if (*p == TAB)
+ *p = ' ';
text = NULL;
}