mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 19:18:34 +00:00
vim-patch:9.1.1776: completion: "adding" expansion doesn't work with cfc=keyword (#35850)
Problem: "adding" expansion doesn't work with cfc=keyword.
Solution: Remove incorrect assignment to compl_cont_status. Don't use
fuzzy collection in "adding" status (zeertzjq).
related: neovim/neovim#35842
closes: vim/vim#18351
e19a882ffc
This commit is contained in:
@@ -4291,8 +4291,9 @@ static int get_next_default_completion(ins_compl_next_state_T *st, pos_T *start_
|
|||||||
{
|
{
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
bool in_fuzzy_collect = (cfc_has_mode() && compl_length > 0)
|
bool in_fuzzy_collect = !compl_status_adding()
|
||||||
|| ((get_cot_flags() & kOptCotFlagFuzzy) && compl_autocomplete);
|
&& ((cfc_has_mode() && compl_length > 0)
|
||||||
|
|| ((get_cot_flags() & kOptCotFlagFuzzy) && compl_autocomplete));
|
||||||
char *leader = ins_compl_leader();
|
char *leader = ins_compl_leader();
|
||||||
int score = FUZZY_SCORE_NONE;
|
int score = FUZZY_SCORE_NONE;
|
||||||
const bool in_curbuf = st->ins_buf == curbuf;
|
const bool in_curbuf = st->ins_buf == curbuf;
|
||||||
@@ -6065,9 +6066,6 @@ static int ins_compl_start(void)
|
|||||||
compl_length = 0;
|
compl_length = 0;
|
||||||
compl_col = curwin->w_cursor.col;
|
compl_col = curwin->w_cursor.col;
|
||||||
compl_lnum = curwin->w_cursor.lnum;
|
compl_lnum = curwin->w_cursor.lnum;
|
||||||
} else if (ctrl_x_mode_normal() && cfc_has_mode()) {
|
|
||||||
compl_startpos = curwin->w_cursor;
|
|
||||||
compl_cont_status &= CONT_S_IPOS;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
edit_submode_pre = NULL;
|
edit_submode_pre = NULL;
|
||||||
|
@@ -3718,6 +3718,14 @@ func Test_complete_fuzzy_collect()
|
|||||||
call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
|
call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
|
||||||
call assert_equal('你的 我的 我的', getline('.'))
|
call assert_equal('你的 我的 我的', getline('.'))
|
||||||
|
|
||||||
|
" check that "adding" expansion works
|
||||||
|
call setline(1, ['hello world foo bar'])
|
||||||
|
call feedkeys("Ohlo\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<Esc>0", 'tx!')
|
||||||
|
call assert_equal('hello world foo bar', getline('.'))
|
||||||
|
call feedkeys("Swld\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<Esc>0", 'tx!')
|
||||||
|
call assert_equal('world foo bar', getline('.'))
|
||||||
|
%delete
|
||||||
|
|
||||||
" fuzzy on file
|
" fuzzy on file
|
||||||
call writefile([''], 'fobar', 'D')
|
call writefile([''], 'fobar', 'D')
|
||||||
call writefile([''], 'foobar', 'D')
|
call writefile([''], 'foobar', 'D')
|
||||||
|
Reference in New Issue
Block a user