]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1852: i_CTRL-O does not reset Select Mode v9.0.1852
authorpierreganty <pierreganty@gmail.com>
Sat, 2 Sep 2023 19:59:52 +0000 (21:59 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 2 Sep 2023 19:59:52 +0000 (21:59 +0200)
Problem:  i_CTRL-O does not reset Select Mode
Solution: Reset select mode on CTRL-O in insert mode

closes: #13001
closes: #12115

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Christian Brabandt <cb@256bit.org>
src/edit.c
src/testdir/test_selectmode.vim
src/version.c

index 0c902f895f443cc07a5de5381df1bb112659d17e..a5154252538fd287b93cc6829246919562824741 100644 (file)
@@ -3859,6 +3859,7 @@ ins_insert(int replaceState)
     static void
 ins_ctrl_o(void)
 {
+    restart_VIsual_select = 0;
     if (State & VREPLACE_FLAG)
        restart_edit = 'V';
     else if (State & REPLACE_FLAG)
index 6e2c36927c136b7ee89aa3e1d286fa2dfb25d5dc..bf1b52b3254e96d2d9016ddcb27997cdb3433f4b 100644 (file)
@@ -310,4 +310,15 @@ func Test_selectmode_register()
   bw!
 endfunc
 
+func Test_ins_ctrl_o_in_insert_mode_resets_selectmode()
+  new
+  " ctrl-o in insert mode resets restart_VIsual_select
+  call setline(1, 'abcdef')
+  call cursor(1, 1)
+  exe "norm! \<c-v>\<c-g>\<c-o>c\<c-o>\<c-v>\<right>\<right>IABC"
+  call assert_equal('ABCbcdef', getline(1))
+
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 605a61c4f6ca529a207567dd847bdf7f4d2cb294..61fe83b785cab31a1c6bdfad4c86f5edfc2b8bc9 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1852,
 /**/
     1851,
 /**/