diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-10 07:20:35 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-10 08:02:22 +0800 |
commit | 263a7fde35f2341f526a536690122b927300021a (patch) | |
tree | 99339f45da62e1054f9384f102e686b557c02c40 /src/nvim/api/vim.c | |
parent | ff726cc569994aab61a42c40270e679dc80cca7c (diff) | |
download | rneovim-263a7fde35f2341f526a536690122b927300021a.tar.gz rneovim-263a7fde35f2341f526a536690122b927300021a.tar.bz2 rneovim-263a7fde35f2341f526a536690122b927300021a.zip |
vim-patch:8.2.4723: the ModeChanged autocmd event is inefficient
Problem: The ModeChanged autocmd event is inefficient.
Solution: Avoid allocating memory. (closes vim/vim#10134) Rename
trigger_modechanged() to may_trigger_modechanged().
https://github.com/vim/vim/commit/2bf52dd065495cbf28e28792f2c2d50d44546d9f
Make v:event readonly for ModeChanged.
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 7c7ada55a2..503a1c9f23 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1549,10 +1549,11 @@ Dictionary nvim_get_mode(void) FUNC_API_SINCE(2) FUNC_API_FAST { Dictionary rv = ARRAY_DICT_INIT; - char *modestr = get_mode(); + char modestr[MODE_MAX_LENGTH]; + get_mode(modestr); bool blocked = input_blocking(); - PUT(rv, "mode", STRING_OBJ(cstr_as_string(modestr))); + PUT(rv, "mode", STRING_OBJ(cstr_to_string(modestr))); PUT(rv, "blocking", BOOLEAN_OBJ(blocked)); return rv; |