changeset 33140:9c4ee9389bb4 v9.0.1852

patch 9.0.1852: i_CTRL-O does not reset Select Mode Commit: https://github.com/vim/vim/commit/d69aecf141ff05a645d02f39f1cbf6381ed7d0c0 Author: pierreganty <pierreganty@gmail.com> Date: Sat Sep 2 21:59:52 2023 +0200 patch 9.0.1852: i_CTRL-O does not reset Select Mode 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>
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Sep 2023 22:15:03 +0200
parents f03fa1631241
children a01ad657a4a9
files src/edit.c src/testdir/test_selectmode.vim src/version.c
diffstat 3 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -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)
--- a/src/testdir/test_selectmode.vim
+++ b/src/testdir/test_selectmode.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1852,
+/**/
     1851,
 /**/
     1850,