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().
2bf52dd065

Make v:event readonly for ModeChanged.
This commit is contained in:
zeertzjq
2022-04-10 07:20:35 +08:00
parent ff726cc569
commit 263a7fde35
12 changed files with 77 additions and 71 deletions

View File

@@ -746,7 +746,11 @@ EXTERN bool listcmd_busy INIT(= false); // set when :argdo, :windo or
// :bufdo is executing
EXTERN bool need_start_insertmode INIT(= false);
// start insert mode soon
EXTERN char *last_mode INIT(= NULL);
#define MODE_MAX_LENGTH 4 // max mode length returned in get_mode()
// including the final NUL character
EXTERN char last_mode[MODE_MAX_LENGTH] INIT(= "n");
EXTERN char_u *last_cmdline INIT(= NULL); // last command line (for ":)
EXTERN char_u *repeat_cmdline INIT(= NULL); // command line for "."
EXTERN char_u *new_last_cmdline INIT(= NULL); // new value for last_cmdline