patch 9.1.1800: completion: strange behaviour with 'ac' completeopt=longest,preinsert
Problem: completion: strange behaviour with 'ac'
completeopt=longest,preinsert (zeertzjq)
Solution: Let preinsert take precedence (Girish Palya)
fixes: #18410
closes: #18428
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
3aa2edb557
commit
d35e5e4237
@ -3100,7 +3100,8 @@ 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) != 0;
|
compl_get_longest = (get_cot_flags() & COT_LONGEST)
|
||||||
|
&& !ins_compl_has_autocomplete();
|
||||||
compl_used_match = TRUE;
|
compl_used_match = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|f|o@1|b|a|r| @68
|
|f|o@1|b|a|r| @68
|
||||||
|f|o@1|b|a|r|b|a|z| @65
|
|f|o@1|b|a|r|b|a|z| @65
|
||||||
|f|o@1> @71
|
|f|o@1> @71
|
||||||
|f+0#0000001#ffd7ff255|o@1| @11| +0#4040ff13#ffffff0@59
|
|f+0#0000001#e0e0e08|o@1| @11| +0#4040ff13#ffffff0@59
|
||||||
|f+0#0000001#ffd7ff255|o@1|b|a|r| @8| +0#4040ff13#ffffff0@59
|
|f+0#0000001#ffd7ff255|o@1|b|a|r| @8| +0#4040ff13#ffffff0@59
|
||||||
|f+0#0000001#ffd7ff255|o@1|b|a|r|b|a|z| @5| +0#4040ff13#ffffff0@59
|
|f+0#0000001#ffd7ff255|o@1|b|a|r|b|a|z| @5| +0#4040ff13#ffffff0@59
|
||||||
|~| @73
|
|~| @73
|
||||||
|~| @73
|
|~| @73
|
||||||
|-+2#0000000&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |B+0#e000002&|a|c|k| |a|t| |o|r|i|g|i|n|a|l| +0#0000000&@29
|
|-+2#0000000&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@33
|
||||||
|
|||||||
@ -5721,7 +5721,7 @@ func Test_autocompletedelay()
|
|||||||
call VerifyScreenDump(buf, 'Test_autocompletedelay_6', {})
|
call VerifyScreenDump(buf, 'Test_autocompletedelay_6', {})
|
||||||
|
|
||||||
" During delay wait, user can open menu using CTRL_N completion
|
" During delay wait, user can open menu using CTRL_N completion
|
||||||
call term_sendkeys(buf, "\<Esc>:set completeopt=menuone,longest\<CR>")
|
call term_sendkeys(buf, "\<Esc>:set completeopt=menuone\<CR>")
|
||||||
call term_sendkeys(buf, "Sf\<C-N>")
|
call term_sendkeys(buf, "Sf\<C-N>")
|
||||||
call VerifyScreenDump(buf, 'Test_autocompletedelay_7', {})
|
call VerifyScreenDump(buf, 'Test_autocompletedelay_7', {})
|
||||||
|
|
||||||
@ -5871,6 +5871,16 @@ 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'
|
||||||
|
" takes precedence
|
||||||
|
%delete
|
||||||
|
set autocomplete completeopt+=longest,preinsert
|
||||||
|
call setline(1, ['foobar', 'foofoo', 'foobaz', ''])
|
||||||
|
call feedkeys("G", 'tx')
|
||||||
|
call DoTest("f", 'foobar', 2)
|
||||||
|
call assert_equal(1, g:preinserted)
|
||||||
|
|
||||||
|
" Undo
|
||||||
%delete _
|
%delete _
|
||||||
let &l:undolevels = &l:undolevels
|
let &l:undolevels = &l:undolevels
|
||||||
normal! ifoo
|
normal! ifoo
|
||||||
|
|||||||
@ -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 */
|
||||||
|
/**/
|
||||||
|
1800,
|
||||||
/**/
|
/**/
|
||||||
1799,
|
1799,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user