vim-patch:8.2.3610: crash when ModeChanged triggered too early

Problem:    Crash when ModeChanged triggered too early.
Solution:   Trigger ModeChanged after setting VIsual.
a062006b9d
This commit is contained in:
Magnus Groß 2021-11-17 18:31:51 +01:00
parent 1fb101afe4
commit 980c68d036
No known key found for this signature in database
GPG Key ID: 56A1295EB9CA7359
2 changed files with 9 additions and 1 deletions

View File

@ -6789,7 +6789,6 @@ static void n_start_visual_mode(int c)
VIsual_mode = c;
VIsual_active = true;
VIsual_reselect = true;
trigger_modechanged();
// Corner case: the 0 position in a tab may change when going into
// virtualedit. Recalculate curwin->w_cursor to avoid bad highlighting.
//
@ -6801,6 +6800,7 @@ static void n_start_visual_mode(int c)
foldAdjustVisual();
trigger_modechanged();
setmouse();
// Check for redraw after changing the state.
conceal_check_cursor_line();

View File

@ -1727,4 +1727,12 @@ func Test_recursive_ModeChanged()
au!
endfunc
func Test_ModeChanged_starts_visual()
" This was triggering ModeChanged before setting VIsual, causing a crash.
au! ModeChanged * norm 0u
sil! norm 
au! ModeChanged
endfunc
" vim: shiftwidth=2 sts=2 expandtab