Skip to content

Commit 001c26c

Browse files
glepnirchrisbra
authored andcommitted
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent e0a2ab3 commit 001c26c

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/insexpand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,9 @@ ins_compl_stop(int c, int prev_mode, int retval)
24982498
retval = TRUE;
24992499
}
25002500

2501+
if ((c == Ctrl_W || c == Ctrl_U) && ins_compl_preinsert_effect())
2502+
ins_compl_delete();
2503+
25012504
auto_format(FALSE, TRUE);
25022505

25032506
// Trigger the CompleteDonePre event to give scripts a chance to

src/testdir/test_ins_complete.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,6 +3103,14 @@ function Test_completeopt_preinsert()
31033103
call assert_equal("fo ", getline('.'))
31043104
call assert_equal(3, col('.'))
31053105

3106+
call feedkeys("She\<C-X>\<C-N>\<C-U>", 'tx')
3107+
call assert_equal("", getline('.'))
3108+
call assert_equal(1, col('.'))
3109+
3110+
call feedkeys("She\<C-X>\<C-N>\<C-W>", 'tx')
3111+
call assert_equal("", getline('.'))
3112+
call assert_equal(1, col('.'))
3113+
31063114
" whole line
31073115
call feedkeys("Shello hero\<CR>\<C-X>\<C-L>", 'tx')
31083116
call assert_equal("hello hero", getline('.'))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1069,
707709
/**/
708710
1068,
709711
/**/

0 commit comments

Comments
 (0)