# HG changeset patch # User Christian Brabandt # Date 1486658703 -3600 # Node ID 64ccb8029e06397433e3b756de215d8035ec998c # Parent c2b6fecdbb0405f170a1e9bec60962b07cbc350b patch 8.0.0319: insert mode completion does not respect 'backspace' commit https://github.com/vim/vim/commit/190b04cdd936f4696c22466b7f077f9371d96580 Author: Bram Moolenaar Date: Thu Feb 9 17:37:03 2017 +0100 patch 8.0.0319: insert mode completion does not respect 'backspace' Problem: Insert mode completion does not respect "start" in 'backspace'. Solution: Check whether backspace can go before where insert started. (Hirohito Higashi) diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -3467,10 +3467,13 @@ ins_compl_bs(void) 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. */ + * 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; /* Deleted more than what was used to find matches or didn't finish diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -511,4 +511,24 @@ func Test_completion_clear_candidate_lis bw! 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\\\\\\\", "tx") + call assert_equal('aaa', getline(1)) + + %d + set bs=indent,eol,start + call setline(1, li) + 1 + call feedkeys("A\\\\\\\", "tx") + call assert_equal('', getline(1)) + + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 319, +/**/ 318, /**/ 317,