aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-05 10:28:21 +0100
committerGitHub <noreply@github.com>2017-03-05 10:28:21 +0100
commit6a56ac2ecad89c5b00d5d4033f5570f417ee73d5 (patch)
tree3f08a2d221eeb665412bd08d8fa242ffd411b193 /src/nvim/edit.c
parent32a9808bc514bca4baaf2f09668a4cb9f755bb4b (diff)
parentcf0b344df14aa5de16ab0a7081ef20d44360c45e (diff)
downloadrneovim-6a56ac2ecad89c5b00d5d4033f5570f417ee73d5.tar.gz
rneovim-6a56ac2ecad89c5b00d5d4033f5570f417ee73d5.tar.bz2
rneovim-6a56ac2ecad89c5b00d5d4033f5570f417ee73d5.zip
Merge #6209 from Shougo/vim-8.0.0319
vim-patch: 8.0.0319, 8.0.0347
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index edfd7e7460..aa029c38a2 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -2914,11 +2914,14 @@ static int ins_compl_bs(void)
p = line + curwin->w_cursor.col;
mb_ptr_back(line, p);
- /* Stop completion when the whole word was deleted. For Omni completion
- * allow the word to be deleted, we won't match everything. */
+ // Stop completion when the whole word was deleted. For Omni completion
+ // allow the word to be deleted, we won't match everything.
+ // Respect the 'backspace' option.
if ((int)(p - line) - (int)compl_col < 0
|| ((int)(p - line) - (int)compl_col == 0
- && ctrl_x_mode != CTRL_X_OMNI) || ctrl_x_mode == CTRL_X_EVAL) {
+ && ctrl_x_mode != CTRL_X_OMNI) || ctrl_x_mode == CTRL_X_EVAL
+ || (!can_bs(BS_START) && (int)(p - line) - (int)compl_col
+ - compl_length < 0)) {
return K_BS;
}
@@ -4341,6 +4344,7 @@ static int ins_complete(int c, bool enable_pum)
int save_w_wrow;
int save_w_leftcol;
int insert_match;
+ int save_did_ai = did_ai;
compl_direction = ins_compl_key2dir(c);
insert_match = ins_compl_use_match(c);
@@ -4556,6 +4560,8 @@ static int ins_complete(int c, bool enable_pum)
if (*funcname == NUL) {
EMSG2(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION
? "completefunc" : "omnifunc");
+ // restore did_ai, so that adding comment leader works
+ did_ai = save_did_ai;
return FAIL;
}