From e005b8d2eb0d5967d46cae604e3fac0ccae37555 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 1 Apr 2024 05:39:52 +0800 Subject: vim-patch:9.1.0230: TextChanged autocommand not triggered under some circumstances (#28135) Problem: TextChanged autocommand not triggered under some circumstances (Sergey Vlasov) Solution: Trigger TextChanged when TextChangedI has not been triggered fixes: vim/vim#14332 closes: vim/vim#14339 https://github.com/vim/vim/commit/86032702932995db74fed265ba99ae0c823cb75d Co-authored-by: Christian Brabandt --- src/nvim/edit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 8b8345657c..0326096486 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -365,9 +365,10 @@ static void insert_enter(InsertState *s) did_cursorhold = false; // ins_redraw() triggers TextChangedI only when no characters - // are in the typeahead buffer, so only reset curbuf->b_last_changedtick + // are in the typeahead buffer, so reset curbuf->b_last_changedtick // if the TextChangedI was not blocked by char_avail() (e.g. using :norm!) - if (!char_avail()) { + // and the TextChangedI autocommand has been triggered + if (!char_avail() && curbuf->b_last_changedtick_i == buf_get_changedtick(curbuf)) { curbuf->b_last_changedtick = buf_get_changedtick(curbuf); } } -- cgit