Christian wrote:

> On Mi, 08 Aug 2018, Bram Moolenaar wrote:
> 
> > Patch 8.1.0256 (after 8.1.0245)
> > Problem:    Using setline() in TextChangedI splits undo.
> > Solution:   Use another solution for undo not working properly.
> > Files:          src/edit.c, src/testdir/test_autocmd.vim
> > 
> > --- 1721,1736 ----
> >         )
> >       {
> >     aco_save_T      aco;
> > !   varnumber_T     tick = CHANGEDTICK(curbuf);
> >   
> >     // save and restore curwin and curbuf, in case the autocmd changes them
> >     aucmd_prepbuf(&aco, curbuf);
> >     apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
> >     aucmd_restbuf(&aco);
> 
> Is there a reason for not using `ins_apply_autocmds(EVENT_TEXTCHANGEDI);` 
> here?
> Perhaps because of aucmd_prepbuf/aucmd_restbuf? So perhaps move those 
> calls into ins_apply_autocmds() as well?
> Also for EVENT_TEXTCHANGEDP further below.

These calls may change the current buffer, thus using
ins_apply_autocmds() might use the wrong curbuf, since it happens before
aucmd_restbuf().

Adding aucmd_prepbuf() and aucmd_restbuf() for all of the
apply_autocmds() calls would be possible, but I'm not sure the extra
overhead is justified.

-- 
ROBIN:  The what?
ARTHUR: The Holy Hand Grenade of Antioch.  'Tis one of the sacred relics
        Brother Maynard always carries with him.
ALL:    Yes. Of course.
ARTHUR: (shouting) Bring up the Holy Hand Grenade!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui