aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-21 07:14:45 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-02-21 07:45:30 +0800
commit1fb606b2ff68b42f77aad6f9a6e00c37e1b2aab0 (patch)
treeeaa6a3aa1fb7e841fa6d209c89d5d6416d1dfa2c /src
parent145c2e720c1eb09093aaf006fcb4396dac44620c (diff)
downloadrneovim-1fb606b2ff68b42f77aad6f9a6e00c37e1b2aab0.tar.gz
rneovim-1fb606b2ff68b42f77aad6f9a6e00c37e1b2aab0.tar.bz2
rneovim-1fb606b2ff68b42f77aad6f9a6e00c37e1b2aab0.zip
vim-patch:9.1.1126: patch 9.1.1121 used a wrong way to handle enter
Problem: patch 9.1.1121 used a wrong way to handle enter Solution: compl_enter_selects also needs to consider the selected item in ins_compl_new_leader() (glepnir) closes: vim/vim#16673 https://github.com/vim/vim/commit/44180416981000ad0bc5db4686889892e7a05cdd Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/insexpand.c9
1 files changed, 1 insertions, 8 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