diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-11 11:32:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 11:32:15 +0800 |
commit | f89ca7194f484108529cbb93ef61ce45a9a277b5 (patch) | |
tree | 0be4ec88907b0b647a177d7ed83b27ff27294176 /src | |
parent | cdfb045ea027e018f14fb2735c3fd6aaa718ae58 (diff) | |
download | rneovim-f89ca7194f484108529cbb93ef61ce45a9a277b5.tar.gz rneovim-f89ca7194f484108529cbb93ef61ce45a9a277b5.tar.bz2 rneovim-f89ca7194f484108529cbb93ef61ce45a9a277b5.zip |
fix(events): make v:event readonly in more events (#18070)
This makes v:event readonly in these four events:
- ChanInfo
- ChanOpen
- RecordingLeave
- TermClose
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/channel.c | 1 | ||||
-rw-r--r-- | src/nvim/ops.c | 1 | ||||
-rw-r--r-- | src/nvim/terminal.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/channel.c b/src/nvim/channel.c index f87b3a2f8f..ac6c9cd110 100644 --- a/src/nvim/channel.c +++ b/src/nvim/channel.c @@ -836,6 +836,7 @@ static void set_info_event(void **argv) typval_T retval; (void)object_to_vim(DICTIONARY_OBJ(info), &retval, NULL); tv_dict_add_dict(dict, S_LEN("info"), retval.vval.v_dict); + tv_dict_set_keys_readonly(dict); apply_autocmds(event, NULL, NULL, false, curbuf); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index dab6d237bf..badc00fb39 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -944,6 +944,7 @@ int do_record(int c) buf[0] = (char)regname; buf[1] = NUL; (void)tv_dict_add_str(dict, S_LEN("regname"), buf); + tv_dict_set_keys_readonly(dict); // Get the recorded key hits. K_SPECIAL will be escaped, this // needs to be removed again to put it in a register. exec_reg then diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 59e0d4da6c..fd870361c7 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -336,6 +336,7 @@ void terminal_close(Terminal *term, int status) save_v_event_T save_v_event; dict_T *dict = get_v_event(&save_v_event); tv_dict_add_nr(dict, S_LEN("status"), status); + tv_dict_set_keys_readonly(dict); apply_autocmds(EVENT_TERMCLOSE, NULL, NULL, false, buf); restore_v_event(dict, &save_v_event); } |