aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/insexpand.c9
-rw-r--r--test/old/testdir/test_edit.vim4
2 files changed, 3 insertions, 10 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index c33c4a1ad9..3d8e083a95 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -1913,7 +1913,7 @@ static void ins_compl_new_leader(void)
compl_restarting = false;
}
- compl_enter_selects = !compl_used_match;
+ compl_enter_selects = !compl_used_match && compl_selected_item != -1;
// Show the popup menu with a different set of matches.
ins_compl_show_pum();
@@ -2301,7 +2301,6 @@ bool ins_compl_prep(int c)
{
bool retval = false;
const int prev_mode = ctrl_x_mode;
- bool handle_enter = ((c == CAR || c == NL || c == K_KENTER) && compl_selected_item == -1);
// Forget any previous 'special' messages if this is actually
// a ^X mode key - bar ^R, in which case we wait to see what it gives us.
@@ -2368,12 +2367,6 @@ bool ins_compl_prep(int c)
&& !ins_compl_pum_key(c))
|| ctrl_x_mode == CTRL_X_FINISHED) {
retval = ins_compl_stop(c, prev_mode, retval);
- // When it is the Enter key and no selected item, return false, and
- // continue processing the Enter key to insert a new line in the
- // edit function.
- if (retval && handle_enter) {
- retval = false;
- }
}
} else if (ctrl_x_mode == CTRL_X_LOCAL_MSG) {
// Trigger the CompleteDone event to give scripts a chance to act
diff --git a/test/old/testdir/test_edit.vim b/test/old/testdir/test_edit.vim
index 5f1a12e33d..bfb1790a9b 100644
--- a/test/old/testdir/test_edit.vim
+++ b/test/old/testdir/test_edit.vim
@@ -601,7 +601,7 @@ func Test_edit_CTRL_I()
call assert_equal([include, 'two', ''], getline(1, '$'))
call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<cr>\<esc>", 'tnix')
call assert_equal([include, 'three', ''], getline(1, '$'))
- call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<C-y>\<esc>", 'tnix')
+ call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
call assert_equal([include, '', ''], getline(1, '$'))
bw!
endfunc
@@ -629,7 +629,7 @@ func Test_edit_CTRL_K()
%d
call setline(1, 'A')
call cursor(1, 1)
- call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<C-Y>\<esc>", 'tnix')
+ call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
call assert_equal(['A'], getline(1, '$'))
%d
call setline(1, 'A')