aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-10 06:53:26 +0800
committerGitHub <noreply@github.com>2024-02-10 06:53:26 +0800
commit3f419d84fbb918836fd90f2e09eace7ce3266f6b (patch)
tree04113cac4a14bd8a72c66346d2f8d1e094ee5b9d /src/nvim/edit.c
parent0d4d3e4325d475e62ff793391e4aba3c7c8561ee (diff)
downloadrneovim-3f419d84fbb918836fd90f2e09eace7ce3266f6b.tar.gz
rneovim-3f419d84fbb918836fd90f2e09eace7ce3266f6b.tar.bz2
rneovim-3f419d84fbb918836fd90f2e09eace7ce3266f6b.zip
vim-patch:9.1.0088: TextChanged not triggered for :norm! commands (#27405)
Problem: TextChanged not triggered for :norm! commands (machakann, after v9.0.2031) Solution: Only reset curbuf->b_last_changedtick if TextChangedI was triggered in insert mode (and not blocked) Note: for unknown reasons, the test fails on Windows (but seems to work fine when running interactively) fixes: vim/vim#13967 closes: vim/vim#13984 https://github.com/vim/vim/commit/c9e79e52845d51f48f5ea3753a62ab3fe0e40184 Cherry-pick test_autocmd.vim change from patch 8.2.4149. Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 41df039b85..b7b32883c2 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -363,7 +363,13 @@ static void insert_enter(InsertState *s)
ins_apply_autocmds(EVENT_INSERTLEAVE);
}
did_cursorhold = false;
- curbuf->b_last_changedtick = buf_get_changedtick(curbuf);
+
+ // ins_redraw() triggers TextChangedI only when no characters
+ // are in the typeahead buffer, so only reset curbuf->b_last_changedtick
+ // if the TextChangedI was not blocked by char_avail() (e.g. using :norm!)
+ if (!char_avail()) {
+ curbuf->b_last_changedtick = buf_get_changedtick(curbuf);
+ }
}
static int insert_check(VimState *state)