Mercurial > vim
comparison src/insexpand.c @ 28397:d1702731786c v8.2.4723
patch 8.2.4723: the ModeChanged autocmd event is inefficient
Commit: https://github.com/vim/vim/commit/2bf52dd065495cbf28e28792f2c2d50d44546d9f
Author: LemonBoy <thatlemon@gmail.com>
Date: Sat Apr 9 18:17:34 2022 +0100
patch 8.2.4723: the ModeChanged autocmd event is inefficient
Problem: The ModeChanged autocmd event is inefficient.
Solution: Avoid allocating memory. (closes https://github.com/vim/vim/issues/10134) Rename
trigger_modechanged() to may_trigger_modechanged().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 09 Apr 2022 19:30:02 +0200 |
parents | a9eeb18e749c |
children | d770568e6c98 |
comparison
equal
deleted
inserted
replaced
28396:cf018ac0499c | 28397:d1702731786c |
---|---|
255 else | 255 else |
256 // CTRL-X in CTRL-X CTRL-V mode behaves differently to make CTRL-X | 256 // CTRL-X in CTRL-X CTRL-V mode behaves differently to make CTRL-X |
257 // CTRL-V look like CTRL-N | 257 // CTRL-V look like CTRL-N |
258 ctrl_x_mode = CTRL_X_CMDLINE_CTRL_X; | 258 ctrl_x_mode = CTRL_X_CMDLINE_CTRL_X; |
259 | 259 |
260 trigger_modechanged(); | 260 may_trigger_modechanged(); |
261 } | 261 } |
262 | 262 |
263 /* | 263 /* |
264 * Functions to check the current CTRL-X mode. | 264 * Functions to check the current CTRL-X mode. |
265 */ | 265 */ |
2379 else if (ctrl_x_mode == CTRL_X_LOCAL_MSG) | 2379 else if (ctrl_x_mode == CTRL_X_LOCAL_MSG) |
2380 // Trigger the CompleteDone event to give scripts a chance to act | 2380 // Trigger the CompleteDone event to give scripts a chance to act |
2381 // upon the (possibly failed) completion. | 2381 // upon the (possibly failed) completion. |
2382 ins_apply_autocmds(EVENT_COMPLETEDONE); | 2382 ins_apply_autocmds(EVENT_COMPLETEDONE); |
2383 | 2383 |
2384 trigger_modechanged(); | 2384 may_trigger_modechanged(); |
2385 | 2385 |
2386 // reset continue_* if we left expansion-mode, if we stay they'll be | 2386 // reset continue_* if we left expansion-mode, if we stay they'll be |
2387 // (re)set properly in ins_complete() | 2387 // (re)set properly in ins_complete() |
2388 if (!vim_is_ctrl_x_key(c)) | 2388 if (!vim_is_ctrl_x_key(c)) |
2389 { | 2389 { |
2863 compl_enter_selects = compl_no_insert; | 2863 compl_enter_selects = compl_no_insert; |
2864 | 2864 |
2865 // Lazily show the popup menu, unless we got interrupted. | 2865 // Lazily show the popup menu, unless we got interrupted. |
2866 if (!compl_interrupted) | 2866 if (!compl_interrupted) |
2867 show_pum(save_w_wrow, save_w_leftcol); | 2867 show_pum(save_w_wrow, save_w_leftcol); |
2868 trigger_modechanged(); | 2868 may_trigger_modechanged(); |
2869 out_flush(); | 2869 out_flush(); |
2870 } | 2870 } |
2871 | 2871 |
2872 /* | 2872 /* |
2873 * "complete()" function | 2873 * "complete()" function |
3816 compl_curr_match = compl_dir_forward() ? compl_old_match->cp_next | 3816 compl_curr_match = compl_dir_forward() ? compl_old_match->cp_next |
3817 : compl_old_match->cp_prev; | 3817 : compl_old_match->cp_prev; |
3818 if (compl_curr_match == NULL) | 3818 if (compl_curr_match == NULL) |
3819 compl_curr_match = compl_old_match; | 3819 compl_curr_match = compl_old_match; |
3820 } | 3820 } |
3821 trigger_modechanged(); | 3821 may_trigger_modechanged(); |
3822 | 3822 |
3823 return i; | 3823 return i; |
3824 } | 3824 } |
3825 | 3825 |
3826 /* | 3826 /* |