comparison src/textprop.c @ 29581:4a79bca8a76e v9.0.0131

patch 9.0.0131: virtual text with Tab is not displayed correctly Commit: https://github.com/vim/vim/commit/783ef7214b6a33300bd83f616c1ead587370ce49 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 1 16:11:06 2022 +0100 patch 9.0.0131: virtual text with Tab is not displayed correctly Problem: Virtual text with Tab is not displayed correctly. Solution: Change any Tab to a space.
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Aug 2022 17:15:02 +0200
parents 14b139cbec49
children e357bc89bb95
comparison
equal deleted inserted replaced
29580:11db5a699881 29581:4a79bca8a76e
224 goto theend; 224 goto theend;
225 } 225 }
226 226
227 if (text != NULL) 227 if (text != NULL)
228 { 228 {
229 garray_T *gap = &buf->b_textprop_text; 229 garray_T *gap = &buf->b_textprop_text;
230 char_u *p;
230 231
231 // double check we got the right ID 232 // double check we got the right ID
232 if (-id - 1 != gap->ga_len) 233 if (-id - 1 != gap->ga_len)
233 iemsg("text prop ID mismatch"); 234 iemsg("text prop ID mismatch");
234 if (gap->ga_growsize == 0) 235 if (gap->ga_growsize == 0)
235 ga_init2(gap, sizeof(char *), 50); 236 ga_init2(gap, sizeof(char *), 50);
236 if (ga_grow(gap, 1) == FAIL) 237 if (ga_grow(gap, 1) == FAIL)
237 goto theend; 238 goto theend;
238 ((char_u **)gap->ga_data)[gap->ga_len++] = text; 239 ((char_u **)gap->ga_data)[gap->ga_len++] = text;
240
241 // change any Tab to a Space to make it simpler to compute the size
242 for (p = text; *p != NUL; MB_PTR_ADV(p))
243 if (*p == TAB)
244 *p = ' ';
239 text = NULL; 245 text = NULL;
240 } 246 }
241 247
242 for (lnum = start_lnum; lnum <= end_lnum; ++lnum) 248 for (lnum = start_lnum; lnum <= end_lnum; ++lnum)
243 { 249 {