comparison src/edit.c @ 25790:16a7d1154be8 v8.2.3430

patch 8.2.3430: no generic way to trigger an autocommand on mode change Commit: https://github.com/vim/vim/commit/f1e8876fa2359b572d262772747405d3616db670 Author: =?UTF-8?q?Magnus=20Gro=C3=9F?= <magnus.gross@rwth-aachen.de> Date: Sun Sep 12 13:39:55 2021 +0200 patch 8.2.3430: no generic way to trigger an autocommand on mode change Problem: No generic way to trigger an autocommand on mode change. Solution: Add the ModeChanged autocommand event. (Magnus Gross, closes https://github.com/vim/vim/issues/8856)
author Bram Moolenaar <Bram@vim.org>
date Sun, 12 Sep 2021 13:45:05 +0200
parents 0082503ff2ff
children 37bc83bbda91
comparison
equal deleted inserted replaced
25789:3afd5ab3d69a 25790:16a7d1154be8
282 vr_lines_changed = 1; 282 vr_lines_changed = 1;
283 } 283 }
284 else 284 else
285 State = INSERT; 285 State = INSERT;
286 286
287 trigger_modechanged();
287 stop_insert_mode = FALSE; 288 stop_insert_mode = FALSE;
288 289
289 #ifdef FEAT_CONCEAL 290 #ifdef FEAT_CONCEAL
290 // Check if the cursor line needs redrawing after changing State. If 291 // Check if the cursor line needs redrawing after changing State. If
291 // 'concealcursor' is "n" it needs to be redrawn without concealing. 292 // 'concealcursor' is "n" it needs to be redrawn without concealing.
3679 im_save_status(&curbuf->b_p_iminsert); 3680 im_save_status(&curbuf->b_p_iminsert);
3680 im_set_active(FALSE); 3681 im_set_active(FALSE);
3681 #endif 3682 #endif
3682 3683
3683 State = NORMAL; 3684 State = NORMAL;
3685 trigger_modechanged();
3684 // need to position cursor again (e.g. when on a TAB ) 3686 // need to position cursor again (e.g. when on a TAB )
3685 changed_cline_bef_curs(); 3687 changed_cline_bef_curs();
3686 3688
3687 setmouse(); 3689 setmouse();
3688 #ifdef CURSOR_SHAPE 3690 #ifdef CURSOR_SHAPE
3809 ins_apply_autocmds(EVENT_INSERTCHANGE); 3811 ins_apply_autocmds(EVENT_INSERTCHANGE);
3810 if (State & REPLACE_FLAG) 3812 if (State & REPLACE_FLAG)
3811 State = INSERT | (State & LANGMAP); 3813 State = INSERT | (State & LANGMAP);
3812 else 3814 else
3813 State = replaceState | (State & LANGMAP); 3815 State = replaceState | (State & LANGMAP);
3816 trigger_modechanged();
3814 AppendCharToRedobuff(K_INS); 3817 AppendCharToRedobuff(K_INS);
3815 showmode(); 3818 showmode();
3816 #ifdef CURSOR_SHAPE 3819 #ifdef CURSOR_SHAPE
3817 ui_cursor_shape(); // may show different cursor shape 3820 ui_cursor_shape(); // may show different cursor shape
3818 #endif 3821 #endif