Rick Howe wrote:

> > It will also trigger for :diffthis.  Not for "set nodiff", since that
> > doesn't update diffs, like the FilterWritePost event also didn't.
> > 
> > With internal diff it will trigger more often, e.g. when deleting a
> > word or undo/redo
> > 
> 
> That is great. I found it in patch 8.1.397.
> However, if apply_autocmds() is moved from ex_diffupdate() to diff_redraw()
> like below, the event is triggered on all the diff-related commands including
> 'diffoff' and 'set nodiff'. It is consistent and more useful for a plugin 
> script. Does that make sense?
> 
> Regards,
> Rick
> 
> P.S.
> we need to add 'DiffUpdated' in syntax/vim.vim, right?
> 
> 
> 
> --- diff397.c 2018-09-17 07:44:53.688021100 +0900
> +++ diff.c    2018-09-17 23:07:40.803496500 +0900
> @@ -676,6 +676,8 @@
>               check_topfill(wp, FALSE);
>           }
>       }
> +
> +    apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
>  }
>  
>      static void
> @@ -949,8 +951,6 @@
>      curwin->w_valid_cursor.lnum = 0;
>  
>      diff_redraw(TRUE);
> -
> -    apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
>  }
>  
>  /*

OK, but this may cause the event to be triggered twice.  Actually, we
should not call diff_redraw() after ex_diffupdate(), since it already
includes that.

Hmm, this also triggers the event before diffs are updated.  I think we
should remove calls to diff_redraw() when tp_diff_invalid is set, since
then ex_diffupdate() will be called later, which will call
diff_redraw().  Hmm, no, that makes the test fail, because in a script
the redraw doesn't happen until later.

So we can't trigger the event in diff_redraw(), it must be done
separately.  I'll make some improvements.

-- 
hundred-and-one symptoms of being an internet addict:
84. Books in your bookcase bear the names Bongo, WinSock and Inside OLE

 /// 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