aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-10 07:20:35 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-04-10 08:02:22 +0800
commit263a7fde35f2341f526a536690122b927300021a (patch)
tree99339f45da62e1054f9384f102e686b557c02c40 /src/nvim/normal.c
parentff726cc569994aab61a42c40270e679dc80cca7c (diff)
downloadrneovim-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/normal.c')
-rw-r--r--src/nvim/normal.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 9cee2de0c5..dcfd73a631 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -481,7 +481,7 @@ static void normal_prepare(NormalState *s)
if (finish_op != c) {
ui_cursor_shape(); // may show different cursor shape
}
- trigger_modechanged();
+ may_trigger_modechanged();
// When not finishing an operator and no register name typed, reset the count.
if (!finish_op && !s->oa.regname) {
@@ -920,7 +920,7 @@ normal_end:
// Reset finish_op, in case it was set
s->c = finish_op;
finish_op = false;
- trigger_modechanged();
+ may_trigger_modechanged();
// Redraw the cursor with another shape, if we were in Operator-pending
// mode or did a replace command.
if (s->c || s->ca.cmdchar == 'r') {
@@ -959,7 +959,7 @@ normal_end:
if (restart_VIsual_select == 1) {
VIsual_select = true;
VIsual_select_reg = 0;
- trigger_modechanged();
+ may_trigger_modechanged();
showmode();
restart_VIsual_select = 0;
}
@@ -2299,7 +2299,7 @@ void end_visual_mode(void)
may_clear_cmdline();
adjust_cursor_eol();
- trigger_modechanged();
+ may_trigger_modechanged();
}
/*
@@ -4113,7 +4113,7 @@ static void nv_ctrlg(cmdarg_T *cap)
{
if (VIsual_active) { // toggle Selection/Visual mode
VIsual_select = !VIsual_select;
- trigger_modechanged();
+ may_trigger_modechanged();
showmode();
} else if (!checkclearop(cap->oap)) {
// print full name if count given or :cd used
@@ -4157,7 +4157,7 @@ static void nv_ctrlo(cmdarg_T *cap)
{
if (VIsual_active && VIsual_select) {
VIsual_select = false;
- trigger_modechanged();
+ may_trigger_modechanged();
showmode();
restart_VIsual_select = 2; // restart Select mode later
} else {
@@ -5945,7 +5945,7 @@ static void nv_visual(cmdarg_T *cap)
// or char/line mode
VIsual_mode = cap->cmdchar;
showmode();
- trigger_modechanged();
+ may_trigger_modechanged();
}
redraw_curbuf_later(INVERTED); // update the inversion
} else { // start Visual mode
@@ -6056,7 +6056,7 @@ static void n_start_visual_mode(int c)
foldAdjustVisual();
- trigger_modechanged();
+ may_trigger_modechanged();
setmouse();
// Check for redraw after changing the state.
conceal_check_cursor_line();