aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/testdir/test_edit.vim8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 686eddfb14..2ef15bde9b 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -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();
diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim
index 7a7f4cb036..37786f3ca0 100644
--- a/src/nvim/testdir/test_edit.vim
+++ b/src/nvim/testdir/test_edit.vim
@@ -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