diff options
author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2025-02-24 00:08:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-23 14:08:26 -0800 |
commit | 268a3de0a7737155eb5ab1372a9ed76599751847 (patch) | |
tree | 19631b0c33913c785f10de98b2793d3b727b105e /src | |
parent | 07c5f41da3ad5a609e74da47685f430fcc4896fe (diff) | |
download | rneovim-268a3de0a7737155eb5ab1372a9ed76599751847.tar.gz rneovim-268a3de0a7737155eb5ab1372a9ed76599751847.tar.bz2 rneovim-268a3de0a7737155eb5ab1372a9ed76599751847.zip |
feat(complete): CompleteDone reason "cancel", "discard" #32600
Problem: there is no way to distinguish between user's explicit
completion stop/cancel and other automated reasons.
Solution: update "cancel" reason to be set only on explicit CTRL-e, and
set intentionally vague "discard" otherwise.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/insexpand.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 4ed83312ef..fdae0d7327 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -581,7 +581,8 @@ static void do_autocmd_completedone(int c, int mode, char *word) tv_dict_add_str(v_event, S_LEN("complete_word"), word != NULL ? word : ""); tv_dict_add_str(v_event, S_LEN("complete_type"), mode_str != NULL ? mode_str : ""); - tv_dict_add_str(v_event, S_LEN("reason"), (c == Ctrl_Y ? "accept" : "cancel")); + tv_dict_add_str(v_event, S_LEN("reason"), + (c == Ctrl_Y ? "accept" : (c == Ctrl_E ? "cancel" : "discard"))); tv_dict_set_keys_readonly(v_event); ins_apply_autocmds(EVENT_COMPLETEDONE); |