From 4303399c10b7106ccf350e8a419fe3c15b81c8e0 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 4 Mar 2017 12:24:49 +0900 Subject: vim-patch:8.0.0319 Problem: Insert mode completion does not respect "start" in 'backspace'. Solution: Check whether backspace can go before where insert started. (Hirohito Higashi) https://github.com/vim/vim/commit/190b04cdd936f4696c22466b7f077f9371d96580 --- src/nvim/edit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index edfd7e7460..ccb4455d03 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; } -- cgit From cf0b344df14aa5de16ab0a7081ef20d44360c45e Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 4 Mar 2017 12:35:40 +0900 Subject: vim-patch:8.0.0347 Problem: When using CTRL-X CTRL-U inside a comment, the use of the comment leader may not work. (Klement) Solution: Save and restore did_ai. (Christian Brabandt, closes vim/vim#1494) https://github.com/vim/vim/commit/d099e033703ce0772f152b8df8a763f0b65303ee --- src/nvim/edit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index ccb4455d03..aa029c38a2 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -4344,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); @@ -4559,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; } -- cgit