Christian wrote:

> > while looking into #4427 I noticed that there is some dead code, that 
> > cannot be reached. So here is a patch:
> > 
> > diff --git a/src/textprop.c b/src/textprop.c
> > index cc95546e2..7029daaae 100644
> > --- a/src/textprop.c
> > +++ b/src/textprop.c
> > @@ -1067,13 +1067,7 @@ adjust_prop_columns(
> >         if (bytes_added > 0
> >                 && (tmp_prop.tp_col >= col + (start_incl ? 2 : 1)))
> >         {
> > -           if (tmp_prop.tp_col < col + (start_incl ? 2 : 1))
> > -           {
> > -               tmp_prop.tp_len += (tmp_prop.tp_col - 1 - col) + 
> > bytes_added;
> > -               tmp_prop.tp_col = col + 1;
> > -           }
> > -           else
> > -               tmp_prop.tp_col += bytes_added;
> > +           tmp_prop.tp_col += bytes_added;
> >             // Save for undo if requested and not done yet.
> >             if ((flags & APC_SAVE_FOR_UNDO) && !dirty)
> >                 u_savesub(lnum);
> > 
> > 
> > BTW: I think the problem for #4427 is, that one uses the old byte column
> > numbers for adjust_prop_columns(), while one should use the column
> > numbers for the newly added text.
> 
> I think the attached patch fixes the problem.
> 
> I don't know text properties very well, so please verify.

The computation wasn't quite right, but it was in the right place.  We
need to accumulate the added bytes.

-- 
You can test a person's importance in the organization by asking how much RAM
his computer has.  Anybody who knows the answer to that question is not a
decision-maker.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/201910252038.x9PKc4WN003358%40masaka.moolenaar.net.

Raspunde prin e-mail lui