mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
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)
190b04cdd9
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -482,6 +482,26 @@ func Test_completion_ctrl_e_without_autowrap()
|
||||
q!
|
||||
endfunc
|
||||
|
||||
func Test_completion_respect_bs_option()
|
||||
new
|
||||
let li = ["aaa", "aaa12345", "aaaabcdef", "aaaABC"]
|
||||
|
||||
set bs=indent,eol
|
||||
call setline(1, li)
|
||||
1
|
||||
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
|
||||
call assert_equal('aaa', getline(1))
|
||||
|
||||
%d
|
||||
set bs=indent,eol,start
|
||||
call setline(1, li)
|
||||
1
|
||||
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
|
||||
call assert_equal('', getline(1))
|
||||
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
func CompleteUndo() abort
|
||||
call complete(1, g:months)
|
||||
return ''
|
||||
|
Reference in New Issue
Block a user