aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-02 06:35:20 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-03-02 07:02:10 +0800
commit26775183ff67968cef06d42666f451c0d1e5c4dc (patch)
tree5f8688f8f6cf11adb11e2a8f7638802fe3e013b7 /src/nvim/edit.c
parent47b748af5465201cfba710efb9ca695d2b19304b (diff)
downloadrneovim-26775183ff67968cef06d42666f451c0d1e5c4dc.tar.gz
rneovim-26775183ff67968cef06d42666f451c0d1e5c4dc.tar.bz2
rneovim-26775183ff67968cef06d42666f451c0d1e5c4dc.zip
vim-patch:9.1.1160: Ctrl-Y does not work well with "preinsert" when completing items
Problem: The 'preinsert' feature requires Ctrl-Y to confirm insertion, but Ctrl-Y only works when the popup menu (pum) is displayed. Without enforcing this dependency, it could lead to confusing behavior or non-functional features. Solution: Modify ins_compl_has_preinsert() to check for both 'menu' and 'menuone' flags when 'preinsert' is set. Update documentation to clarify this requirement. This avoids adding complex conditional behaviors. (glepnir) fixes: vim/vim#16728 closes: vim/vim#16753 https://github.com/vim/vim/commit/a2c5559f297a18dc1ce3c4f1f9fd6204aed321c9 Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 223b0acbc0..f5ba9c1c05 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -563,10 +563,8 @@ static int insert_execute(VimState *state, int key)
// Special handling of keys while the popup menu is visible or wanted
// and the cursor is still in the completed word. Only when there is
// a match, skip this when no matches were found.
- bool ins_completion = ins_compl_active()
- && curwin->w_cursor.col >= ins_compl_col()
- && ins_compl_has_shown_match();
- if (ins_completion && pum_wanted()) {
+ if (ins_compl_active() && curwin->w_cursor.col >= ins_compl_col()
+ && ins_compl_has_shown_match() && pum_wanted()) {
// BS: Delete one character from "compl_leader".
if ((s->c == K_BS || s->c == Ctrl_H)
&& curwin->w_cursor.col > ins_compl_col()
@@ -616,8 +614,6 @@ static int insert_execute(VimState *state, int key)
ins_compl_delete(false);
}
}
- } else if (ins_completion && !pum_wanted() && ins_compl_preinsert_effect()) {
- ins_compl_delete(false);
}
// Prepare for or stop CTRL-X mode. This doesn't do completion, but it does