John Marriott wrote:

> On 15-Aug-2021 22:32, Bram Moolenaar wrote:
> > Patch 8.2.3348
> > Problem:    line2byte() returns wrong value after adding textprop. (Yuto
> >              Kimura)
> > Solution:   Reduce the length by the size of the text property. (closes 
> > #8759)
> > Files:      src/memline.c, src/testdir/test_textprop.vim
> >
> >
> Hi All,
> 
> After this patch, mingw64 (gcc 11.2.0) spits out this error message if 
> FEAT_PROP_POPUP is not defined:
> <snip>
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
> -fpie -fPIE  memline.c -o objnative/memline.o memline.c: In function 
> 'ml_flush_line':
> memline.c:4002:24: error: 'buf_T' {aka 'struct file_buffer'} has no 
> member named 'b_has_textprop'
>   4002 |                 if (buf->b_has_textprop)
>        |                        ^~
> memline.c:4011:24: error: 'buf_T' {aka 'struct file_buffer'} has no 
> member named 'b_has_textprop'
>   4011 |                 if (buf->b_has_textprop)
>        |                        ^~
> make: *** [Make_cyg_ming.mak:1159: objnative/memline.o] Error 1
> </snip>
> 
> There might be a mismatch of ifdef tests here.
> structs.h includes "b_has_textprop" if FEAT_PROP_POPUP is defined (line 
> 3038 in structs.h):
> <snip>
> #ifdef FEAT_PROP_POPUP
>      int        b_has_textprop;    // TRUE when text props were added
>      hashtab_T    *b_proptypes;    // text property types local to buffer
> #endif
> </snip>
> 
> But this patch tries to use it if FEAT_BYTEOFF is defined (line 4001 in 
> memline.c):
> <snip>
> #ifdef FEAT_BYTEOFF
>          if (buf->b_has_textprop)
>              old_prop_len = old_len - STRLEN(new_line) - 1;
> #endif
> </snip>
> 
> (line 4009 in memline.,c):
> </snip>
> #ifdef FEAT_BYTEOFF
>          // The else case is already covered by the insert and delete
>          if (buf->b_has_textprop)
>          {
>              // Do not count the size of any text properties.
>              extra += old_prop_len;
>              extra -= new_len - STRLEN(new_line) - 1;
>          }
>          if (extra != 0)
>              ml_updatechunk(buf, lnum, (long)extra, ML_CHNK_UPDLINE);
> #endif
> </snip>
> 
> Defining FEAT_PROP_POPUP fixes the problem providing FEAT_SPELL or 
> FEAT_QUICKFIX is also defined.

The #ifdef should check both FEAT_BYTEOFF and FEAT_PROP_POPUP, the code
is only needed when both are defined.  I'll make a patch.

-- 
Veni, Vidi, VW -- I came, I saw, I drove around in a little car.

 /// 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/202108152011.17FKBQk54088119%40masaka.moolenaar.net.

Raspunde prin e-mail lui