mirror of
https://github.com/neovim/neovim.git
synced 2026-09-09 07:25:51 +00:00
fix(cwd): :bcd completion shows non-directories #41661
Problem: Completion for `:bcd` shows files, not just directories. Solution: Set the ctx properly.
This commit is contained in:
@@ -2047,6 +2047,8 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
|
||||
kCallbackNone ? EXPAND_FINDFUNC : EXPAND_FILES_IN_PATH;
|
||||
}
|
||||
break;
|
||||
case CMD_bcd:
|
||||
case CMD_bchdir:
|
||||
case CMD_cd:
|
||||
case CMD_chdir:
|
||||
case CMD_lcd:
|
||||
|
||||
@@ -1068,6 +1068,21 @@ describe('completion', function()
|
||||
eq('edit', fn.getcompletion('restart ed', 'cmdline')[1])
|
||||
end)
|
||||
|
||||
it('cmdline completion for :*cd family shows dirs only', function()
|
||||
local dir = 'Xtest-cd-compl/'
|
||||
local subdir1 = dir .. 'subdir1/'
|
||||
local subdir2 = dir .. 'subdir2/'
|
||||
finally(function()
|
||||
n.rmdir(dir)
|
||||
end)
|
||||
fn.mkdir(subdir1, 'p')
|
||||
fn.mkdir(subdir2, 'p')
|
||||
fn.writefile({ '' }, dir .. 'file')
|
||||
for _, cmd in ipairs({ 'cd', 'lcd', 'tcd', 'bcd' }) do
|
||||
eq({ subdir1, subdir2 }, fn.getcompletion(cmd .. ' ' .. dir, 'cmdline'))
|
||||
end
|
||||
end)
|
||||
|
||||
describe('from the commandline window', function()
|
||||
it('is cleared after CTRL-C', function()
|
||||
feed('q:')
|
||||
|
||||
Reference in New Issue
Block a user