]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1069: preinsert text completions not deleted with <C-W>/<C-U> v9.1.1069
authorglepnir <glephunter@gmail.com>
Sun, 2 Feb 2025 08:36:22 +0000 (09:36 +0100)
committerChristian Brabandt <cb@256bit.org>
Sun, 2 Feb 2025 08:36:22 +0000 (09:36 +0100)
Problem:  preinsert text completions not deleted with <C-W>/<C-U>
          (ddad431, after v9.1.1059)
Solution: handle <C-W> or <C-U> specifically and clear the completion
          (glepnir)

fixes: #16557
closes: #16565

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/testdir/test_ins_complete.vim
src/version.c

index df757ce9b8aac9b26e8554253db6456ea94c02c2..856c06d593ef158ba2d2ccb89141e500f589da0d 100644 (file)
@@ -2498,6 +2498,9 @@ ins_compl_stop(int c, int prev_mode, int retval)
        retval = TRUE;
     }
 
+    if ((c == Ctrl_W || c == Ctrl_U) && ins_compl_preinsert_effect())
+       ins_compl_delete();
+
     auto_format(FALSE, TRUE);
 
     // Trigger the CompleteDonePre event to give scripts a chance to
index 49e44653a26ec9614d17fff4be889f028dc550ca..5d24d51d6a84c93a4e0ebca6b7857c7fc4936dad 100644 (file)
@@ -3103,6 +3103,14 @@ function Test_completeopt_preinsert()
   call assert_equal("fo ", getline('.'))
   call assert_equal(3, col('.'))
 
+  call feedkeys("She\<C-X>\<C-N>\<C-U>", 'tx')
+  call assert_equal("", getline('.'))
+  call assert_equal(1, col('.'))
+
+  call feedkeys("She\<C-X>\<C-N>\<C-W>", 'tx')
+  call assert_equal("", getline('.'))
+  call assert_equal(1, col('.'))
+
   " whole line
   call feedkeys("Shello hero\<CR>\<C-X>\<C-L>", 'tx')
   call assert_equal("hello hero", getline('.'))
index 7137c675bbdddf7f426d97a54789d4054a92a159..f9d99a5dc34c313c776b1cf95924123fdc22ed3e 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1069,
 /**/
     1068,
 /**/