aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 164194f5a7..7e917336e5 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -3267,7 +3267,7 @@ static bool ins_compl_prep(int c)
dec_cursor();
}
- if (!arrow_used && !ins_need_undo) {
+ if (!arrow_used && !ins_need_undo && c != Ctrl_E) {
insertchar(NUL, 0, -1);
}
@@ -3286,7 +3286,8 @@ static bool ins_compl_prep(int c)
retval = true;
}
- /* CTRL-E means completion is Ended, go back to the typed text. */
+ // CTRL-E means completion is Ended, go back to the typed text.
+ // but only do this, if the Popup is still visible
if (c == Ctrl_E) {
ins_compl_delete();
if (compl_leader != NULL) {
@@ -4516,14 +4517,15 @@ static int ins_complete(int c, bool enable_pum)
} else if (ctrl_x_mode == CTRL_X_CMDLINE) {
compl_pattern = vim_strnsave(line, curs_col);
set_cmd_context(&compl_xp, compl_pattern,
- (int)STRLEN(compl_pattern), curs_col);
+ (int)STRLEN(compl_pattern), curs_col, false);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
- || compl_xp.xp_context == EXPAND_NOTHING)
- /* No completion possible, use an empty pattern to get a
- * "pattern not found" message. */
+ || compl_xp.xp_context == EXPAND_NOTHING) {
+ // No completion possible, use an empty pattern to get a
+ // "pattern not found" message.
compl_col = curs_col;
- else
+ } else {
compl_col = (int)(compl_xp.xp_pattern - compl_pattern);
+ }
compl_length = curs_col - compl_col;
} else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode ==
CTRL_X_OMNI) {