patch 9.1.1810: completion: "longest" doesn't work for manual completion with 'ac'
Problem: completion: "longest" doesn't work for manual completion when
'autocomplete' is on (after 9.1.1800).
Solution: Only reset compl_get_longest when enabling autocompletion
(zeertzjq).
closes: #18430
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
c6802f41da
commit
b3966d6a8e
@ -2511,7 +2511,10 @@ ins_compl_new_leader(void)
|
|||||||
save_w_wrow = curwin->w_wrow;
|
save_w_wrow = curwin->w_wrow;
|
||||||
save_w_leftcol = curwin->w_leftcol;
|
save_w_leftcol = curwin->w_leftcol;
|
||||||
compl_restarting = TRUE;
|
compl_restarting = TRUE;
|
||||||
compl_autocomplete = ins_compl_has_autocomplete();
|
if (ins_compl_has_autocomplete())
|
||||||
|
ins_compl_enable_autocomplete();
|
||||||
|
else
|
||||||
|
compl_autocomplete = FALSE;
|
||||||
if (ins_complete(Ctrl_N, FALSE) == FAIL)
|
if (ins_complete(Ctrl_N, FALSE) == FAIL)
|
||||||
compl_cont_status = 0;
|
compl_cont_status = 0;
|
||||||
compl_restarting = FALSE;
|
compl_restarting = FALSE;
|
||||||
@ -3100,8 +3103,7 @@ ins_compl_prep(int c)
|
|||||||
if (ctrl_x_mode_not_defined_yet()
|
if (ctrl_x_mode_not_defined_yet()
|
||||||
|| (ctrl_x_mode_normal() && !compl_started))
|
|| (ctrl_x_mode_normal() && !compl_started))
|
||||||
{
|
{
|
||||||
compl_get_longest = (get_cot_flags() & COT_LONGEST)
|
compl_get_longest = (get_cot_flags() & COT_LONGEST);
|
||||||
&& !ins_compl_has_autocomplete();
|
|
||||||
compl_used_match = TRUE;
|
compl_used_match = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7388,6 +7390,7 @@ ins_compl_enable_autocomplete(void)
|
|||||||
{
|
{
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
compl_autocomplete = TRUE;
|
compl_autocomplete = TRUE;
|
||||||
|
compl_get_longest = FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5871,7 +5871,7 @@ func Test_autocomplete_longest()
|
|||||||
call feedkeys("Go\<ESC>", 'tx')
|
call feedkeys("Go\<ESC>", 'tx')
|
||||||
call DoTest("f\<C-N>\<C-N>\<BS>\<BS>\<BS>\<BS>", 'foo', 3)
|
call DoTest("f\<C-N>\<C-N>\<BS>\<BS>\<BS>\<BS>", 'foo', 3)
|
||||||
|
|
||||||
" Issue #18410: When both 'preinsert' and 'longest' are set, 'preinsert'
|
" Issue #18410: When both "preinsert" and "longest" are set, "preinsert"
|
||||||
" takes precedence
|
" takes precedence
|
||||||
%delete
|
%delete
|
||||||
set autocomplete completeopt+=longest,preinsert
|
set autocomplete completeopt+=longest,preinsert
|
||||||
@ -5922,6 +5922,21 @@ func Test_autocomplete_longest()
|
|||||||
%delete _
|
%delete _
|
||||||
delfunc CheckUndo
|
delfunc CheckUndo
|
||||||
|
|
||||||
|
" Check that behavior of "longest" in manual completion is unchanged.
|
||||||
|
for ac in [v:false, v:true]
|
||||||
|
let &ac = ac
|
||||||
|
set completeopt=menuone,longest
|
||||||
|
call feedkeys("Ssign u\<C-X>\<C-V>", 'tx')
|
||||||
|
call assert_equal('sign un', getline('.'))
|
||||||
|
call feedkeys("Ssign u\<C-X>\<C-V>\<C-V>", 'tx')
|
||||||
|
call assert_equal('sign undefine', getline('.'))
|
||||||
|
call feedkeys("Ssign u\<C-X>\<C-V>\<C-V>\<C-V>", 'tx')
|
||||||
|
call assert_equal('sign unplace', getline('.'))
|
||||||
|
call feedkeys("Ssign u\<C-X>\<C-V>\<C-V>\<C-V>\<C-V>", 'tx')
|
||||||
|
call assert_equal('sign u', getline('.'))
|
||||||
|
%delete
|
||||||
|
endfor
|
||||||
|
|
||||||
bw!
|
bw!
|
||||||
set cot& autocomplete&
|
set cot& autocomplete&
|
||||||
delfunc GetLine
|
delfunc GetLine
|
||||||
|
|||||||
@ -729,6 +729,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1810,
|
||||||
/**/
|
/**/
|
||||||
1809,
|
1809,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user