feat: implement BufModified autocmd

This commit is contained in:
Rom Grk
2020-11-02 02:11:22 -05:00
parent 643f4a1787
commit 24db59ca8f
5 changed files with 25 additions and 0 deletions

View File

@@ -1229,6 +1229,16 @@ static void normal_check_text_changed(NormalState *s)
}
}
static void normal_check_buffer_modified(NormalState *s)
{
// Trigger BufModified if b_modified changed
if (!finish_op && has_event(EVENT_BUFMODIFIED)
&& curbuf->b_changed_notified == false) {
apply_autocmds(EVENT_BUFMODIFIED, NULL, NULL, false, curbuf);
curbuf->b_changed_notified = true;
}
}
static void normal_check_folds(NormalState *s)
{
// Include a closed fold completely in the Visual area.
@@ -1336,6 +1346,7 @@ static int normal_check(VimState *state)
normal_check_cursor_moved(s);
normal_check_text_changed(s);
normal_check_window_scrolled(s);
normal_check_buffer_modified(s);
// Updating diffs from changed() does not always work properly,
// esp. updating folds. Do an update just before redrawing if