diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-07 08:57:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-07 08:57:29 +0800 |
commit | ad244a865be5332471ec07875603c3dd4a7af0ae (patch) | |
tree | 2b0697ba15b535176dd41487c3721267c20006f9 /src | |
parent | a069e88b4ea593419181271bfb41154e45b81090 (diff) | |
download | rneovim-ad244a865be5332471ec07875603c3dd4a7af0ae.tar.gz rneovim-ad244a865be5332471ec07875603c3dd4a7af0ae.tar.bz2 rneovim-ad244a865be5332471ec07875603c3dd4a7af0ae.zip |
fix(events): save v:event for cmdline autocommands separately (#21316)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_getln.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index d763a59d08..6cd5bd6b8c 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -738,13 +738,14 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init TryState tstate; Error err = ERROR_INIT; bool tl_ret = true; - save_v_event_T save_v_event; - dict_T *dict = get_v_event(&save_v_event); char firstcbuf[2]; firstcbuf[0] = (char)(firstc > 0 ? firstc : '-'); firstcbuf[1] = 0; if (has_event(EVENT_CMDLINEENTER)) { + save_v_event_T save_v_event; + dict_T *dict = get_v_event(&save_v_event); + // set v:event to a dictionary with information about the commandline tv_dict_add_str(dict, S_LEN("cmdtype"), firstcbuf); tv_dict_add_nr(dict, S_LEN("cmdlevel"), ccline.level); @@ -806,6 +807,9 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init state_enter(&s->state); if (has_event(EVENT_CMDLINELEAVE)) { + save_v_event_T save_v_event; + dict_T *dict = get_v_event(&save_v_event); + tv_dict_add_str(dict, S_LEN("cmdtype"), firstcbuf); tv_dict_add_nr(dict, S_LEN("cmdlevel"), ccline.level); tv_dict_set_keys_readonly(dict); |