patch 9.1.1069: preinsert text completions not deleted with <C-W>/<C-U>

Commit: 
https://github.com/vim/vim/commit/001c26cd6194fba2bfccb06dec30fdc9e1410e62
Author: glepnir <glephun...@gmail.com>
Date:   Sun Feb 2 09:36:22 2025 +0100

    patch 9.1.1069: preinsert text completions not deleted with <C-W>/<C-U>
    
    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 <glephun...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/insexpand.c b/src/insexpand.c
index df757ce9b..856c06d59 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -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
diff --git a/src/testdir/test_ins_complete.vim 
b/src/testdir/test_ins_complete.vim
index 49e44653a..5d24d51d6 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -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('.'))
diff --git a/src/version.c b/src/version.c
index 7137c675b..f9d99a5dc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1069,
 /**/
     1068,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1teVbD-000Sl6-EE%40256bit.org.

Raspunde prin e-mail lui