Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(cmdline): do not trigger completion at wrong time#19920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zeertzjq merged 1 commit intoneovim:masterfromzeertzjq:cmdline-pum-ctrl-a
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletionssrc/nvim/ex_getln.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1277,8 +1277,11 @@ static int command_line_execute(VimState *state, int key)
// <S-Tab> goes to last match, in a clumsy way
if (s->c == K_S_TAB && KeyTyped) {
if (nextwild(&s->xpc, WILD_EXPAND_KEEP, 0, s->firstc != '@') == OK) {
// Trigger the popup menu when wildoptions=pum
showmatches(&s->xpc, p_wmnu && ((wim_flags[s->wim_index] & WIM_LIST) == 0));
if (s->xpc.xp_numfiles > 1
&& ((!s->did_wild_list && (wim_flags[s->wim_index] & WIM_LIST)) || p_wmnu)) {
// Trigger the popup menu when wildoptions=pum
showmatches(&s->xpc, p_wmnu && ((wim_flags[s->wim_index] & WIM_LIST) == 0));
}
nextwild(&s->xpc, WILD_PREV, 0, s->firstc != '@');
nextwild(&s->xpc, WILD_PREV, 0, s->firstc != '@');
return command_line_changed(s);
Expand DownExpand Up@@ -1798,13 +1801,16 @@ static int command_line_handle_key(CommandLineState *s)
return command_line_not_changed(s);

case Ctrl_A: // all matches
if (nextwild(&s->xpc, WILD_ALL, 0, s->firstc != '@') == FAIL) {
break;
}
if (cmdline_pum_active()) {
// As Ctrl-A completes all the matches, close the popup
// menu (if present)
cmdline_pum_cleanup(&ccline);
s->xpc.xp_context = EXPAND_NOTHING;
}
if (nextwild(&s->xpc, WILD_ALL, 0, s->firstc != '@') == FAIL) {
break;
}
s->xpc.xp_context = EXPAND_NOTHING;
s->did_wild_list = false;
return command_line_changed(s);

case Ctrl_L:
Expand Down
16 changes: 16 additions & 0 deletionstest/functional/ui/popupmenu_spec.lua
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1990,6 +1990,22 @@ describe('builtin popupmenu', function()
efine unplace^ |
]])

-- Pressing <Left> after that should move the cursor
feed('<Left>')
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{4: }|
:sign define jump list place und|
efine unplac^e |
]])
feed('<End>')

-- Pressing <C-D> when the popup menu is displayed should remove the popup
-- menu
feed('<C-U>sign <Tab><C-D>')
Expand Down
58 changes: 54 additions & 4 deletionstest/functional/ui/wildmode_spec.lua
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -461,20 +461,20 @@ end)
describe('command line completion', function()
local screen
before_each(function()
clear()
screen = Screen.new(40, 5)
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {foreground = Screen.colors.Grey0, background = Screen.colors.Yellow},
[3] = {bold = true, reverse = true},
})
screen:attach()
end)
after_each(function()
os.remove('Xtest-functional-viml-compl-dir')
end)

it('lists directories with empty PATH', function()
clear()
screen:attach()
local tmp = funcs.tempname()
command('e '.. tmp)
command('cd %:h')
Expand All@@ -491,8 +491,6 @@ describe('command line completion', function()
end)

it('completes env var names #9681', function()
clear()
screen:attach()
command('let $XTEST_1 = "foo" | let $XTEST_2 = "bar"')
command('set wildmenu wildmode=full')
feed(':!echo $XTEST_<tab>')
Expand DownExpand Up@@ -521,6 +519,58 @@ describe('command line completion', function()
:!echo $XTEST_1AaあB^ |
]])
end)

it('does not leak memory with <S-Tab> with wildmenu and only one match #19874', function()
meths.set_option('wildmenu', true)
meths.set_option('wildmode', 'full')
meths.set_option('wildoptions', 'pum')

feed(':sign unpla<S-Tab>')
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
:sign unplace^ |
]])

feed('<Space>buff<Tab>')
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
:sign unplace buffer=^ |
]])
end)

it('does not show matches with <S-Tab> without wildmenu with wildmode=full', function()
meths.set_option('wildmenu', false)
meths.set_option('wildmode', 'full')

feed(':sign <S-Tab>')
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
:sign unplace^ |
]])
end)

it('shows matches with <S-Tab> without wildmenu with wildmode=list', function()
meths.set_option('wildmenu', false)
meths.set_option('wildmode', 'list')

feed(':sign <S-Tab>')
screen:expect([[
{3: }|
:sign define |
define list undefine |
jump place unplace |
:sign unplace^ |
]])
end)
end)

describe('ui/ext_wildmenu', function()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp