mirror of
https://github.com/neovim/neovim.git
synced 2025-11-04 17:54:30 +00:00
fix(extui): ensure temporary cmdline config is not restored #35301
Problem: Temporary cmdline config is saved to be restored later. Solution: Close the cmdline window so that it is recreated with the appropriate config.
This commit is contained in:
@@ -467,7 +467,6 @@ function M.set_pos(type)
|
|||||||
local height = type and math.min(texth.all, math.ceil(o.lines * 0.5))
|
local height = type and math.min(texth.all, math.ceil(o.lines * 0.5))
|
||||||
local top = { vim.opt.fcs:get().horiz or o.ambw == 'single' and '─' or '-', 'MsgSeparator' }
|
local top = { vim.opt.fcs:get().horiz or o.ambw == 'single' and '─' or '-', 'MsgSeparator' }
|
||||||
local border = win ~= ext.wins.msg and { '', top, '', '', '', '', '', '' } or nil
|
local border = win ~= ext.wins.msg and { '', top, '', '', '', '', '', '' } or nil
|
||||||
local save_config = type == 'cmd' and api.nvim_win_get_config(win) or {}
|
|
||||||
local config = {
|
local config = {
|
||||||
hide = false,
|
hide = false,
|
||||||
relative = 'laststatus',
|
relative = 'laststatus',
|
||||||
@@ -491,11 +490,11 @@ function M.set_pos(type)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
if api.nvim_win_is_valid(win) then
|
|
||||||
api.nvim_win_set_config(win, save_config)
|
|
||||||
end
|
|
||||||
cmd_on_key = nil
|
|
||||||
local entered = api.nvim_get_current_win() == win
|
local entered = api.nvim_get_current_win() == win
|
||||||
|
cmd_on_key = nil
|
||||||
|
if api.nvim_win_is_valid(win) then
|
||||||
|
api.nvim_win_close(win, true)
|
||||||
|
end
|
||||||
ext.check_targets()
|
ext.check_targets()
|
||||||
-- Show or clear the message depending on if the pager was opened.
|
-- Show or clear the message depending on if the pager was opened.
|
||||||
if entered or not api.nvim_win_get_config(ext.wins.pager).hide then
|
if entered or not api.nvim_win_get_config(ext.wins.pager).hide then
|
||||||
|
|||||||
@@ -234,4 +234,23 @@ describe('messages2', function()
|
|||||||
foo [+1] |
|
foo [+1] |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('not restoring already open hit-enter-prompt config #35298', function()
|
||||||
|
command('echo "foo\nbar"')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
{1:~ }|*10
|
||||||
|
{3:─────────────────────────────────────────────────────}|
|
||||||
|
foo |
|
||||||
|
bar |
|
||||||
|
]])
|
||||||
|
command('echo "foo\nbar"')
|
||||||
|
screen:expect_unchanged()
|
||||||
|
feed(':')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|*12
|
||||||
|
{16::}^ |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user