Patch 9.0.0131
Problem:    Virtual text with Tab is not displayed correctly.
Solution:   Change any Tab to a space.
Files:      runtime/doc/textprop.txt, src/textprop.c,
            src/testdir/test_textprop.vim


*** ../vim-9.0.0130/runtime/doc/textprop.txt    2022-07-31 17:11:47.894558952 
+0100
--- runtime/doc/textprop.txt    2022-08-01 16:05:05.813522209 +0100
***************
*** 187,192 ****
--- 187,194 ----
                in the text will move the cursor to the first character after
                the text, or the last character of the line.
                A negative "id" will be chosen and is returned.  Once a
+               Any Tab in the text will be changed to a space (Rationale:
+               otherwise the size of the text is difficult to compute).
                property with "text" has been added for a buffer then using a
                negative "id" for any other property will give an error:
                *E1293*
*** ../vim-9.0.0130/src/textprop.c      2022-07-31 17:11:47.894558952 +0100
--- src/textprop.c      2022-08-01 16:10:08.712768595 +0100
***************
*** 226,232 ****
  
      if (text != NULL)
      {
!       garray_T *gap = &buf->b_textprop_text;
  
        // double check we got the right ID
        if (-id - 1 != gap->ga_len)
--- 226,233 ----
  
      if (text != NULL)
      {
!       garray_T    *gap = &buf->b_textprop_text;
!       char_u      *p;
  
        // double check we got the right ID
        if (-id - 1 != gap->ga_len)
***************
*** 236,241 ****
--- 237,247 ----
        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;
      }
  
*** ../vim-9.0.0130/src/testdir/test_textprop.vim       2022-08-01 
15:52:51.727352432 +0100
--- src/testdir/test_textprop.vim       2022-08-01 16:09:11.224901898 +0100
***************
*** 2197,2203 ****
        call prop_type_add('otherprop', #{highlight: 'Search'})
        call prop_type_add('moreprop', #{highlight: 'DiffAdd'})
        call prop_add(1, 18, #{type: 'someprop', text: 'SOME '})
!       call prop_add(1, 38, #{type: 'otherprop', text: 'OTHER '})
        call prop_add(1, 69, #{type: 'moreprop', text: 'MORE '})
        redraw
        normal $
--- 2197,2203 ----
        call prop_type_add('otherprop', #{highlight: 'Search'})
        call prop_type_add('moreprop', #{highlight: 'DiffAdd'})
        call prop_add(1, 18, #{type: 'someprop', text: 'SOME '})
!       call prop_add(1, 38, #{type: 'otherprop', text: "OTHER\t"})
        call prop_add(1, 69, #{type: 'moreprop', text: 'MORE '})
        redraw
        normal $
***************
*** 2222,2228 ****
        call prop_type_add('afterprop', #{highlight: 'Search'})
        call prop_type_add('belowprop', #{highlight: 'DiffAdd'})
        call prop_add(1, 0, #{type: 'rightprop', text: ' RIGHT ', text_align: 
'right'})
!       call prop_add(1, 0, #{type: 'afterprop', text: ' AFTER ', text_align: 
'after'})
        call prop_add(1, 0, #{type: 'belowprop', text: ' BELOW ', text_align: 
'below'})
  
        call setline(2, 'Last line.')
--- 2222,2228 ----
        call prop_type_add('afterprop', #{highlight: 'Search'})
        call prop_type_add('belowprop', #{highlight: 'DiffAdd'})
        call prop_add(1, 0, #{type: 'rightprop', text: ' RIGHT ', text_align: 
'right'})
!       call prop_add(1, 0, #{type: 'afterprop', text: "\tAFTER\t", text_align: 
'after'})
        call prop_add(1, 0, #{type: 'belowprop', text: ' BELOW ', text_align: 
'below'})
  
        call setline(2, 'Last line.')
*** ../vim-9.0.0130/src/version.c       2022-08-01 15:52:51.727352432 +0100
--- src/version.c       2022-08-01 16:08:28.393003802 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     131,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
221. Your wife melts your keyboard in the oven.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220801151135.42A831C05BA%40moolenaar.net.

Raspunde prin e-mail lui