mirror of
https://github.com/neovim/neovim.git
synced 2025-12-17 11:55:34 +00:00
fix(extui): properly setup "more" window for changed buffer
Problem: Buffer setup after moving the message buffer to the "more"
window after ff95d7ff is incomplete.
Solution: Adjust and invoke tab_check_wins() to do the setup instead.
This commit is contained in:
@@ -170,11 +170,10 @@ end
|
|||||||
|
|
||||||
--- Move message buffer to more window.
|
--- Move message buffer to more window.
|
||||||
local function msg_to_more(tar)
|
local function msg_to_more(tar)
|
||||||
api.nvim_win_set_buf(ext.wins[ext.tab].more, ext.bufs[tar])
|
|
||||||
api.nvim_buf_delete(ext.bufs.more, { force = true })
|
api.nvim_buf_delete(ext.bufs.more, { force = true })
|
||||||
api.nvim_buf_set_name(ext.bufs[tar], 'vim._extui.more')
|
api.nvim_buf_set_name(ext.bufs[tar], 'vim._extui.more')
|
||||||
ext.bufs.more, ext.bufs[tar], M[tar].count = ext.bufs[tar], -1, 0
|
ext.bufs.more, ext.bufs[tar], M[tar].count = ext.bufs[tar], -1, 0
|
||||||
ext.tab_check_wins()
|
ext.tab_check_wins() -- Create and setup new/moved buffer.
|
||||||
M.set_pos('more')
|
M.set_pos('more')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -39,20 +39,16 @@ function M.tab_check_wins()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, type in ipairs({ 'box', 'cmd', 'more', 'prompt' }) do
|
for _, type in ipairs({ 'box', 'cmd', 'more', 'prompt' }) do
|
||||||
if not api.nvim_buf_is_valid(M.bufs[type]) then
|
local setopt = not api.nvim_buf_is_valid(M.bufs[type])
|
||||||
|
if setopt then
|
||||||
M.bufs[type] = api.nvim_create_buf(false, true)
|
M.bufs[type] = api.nvim_create_buf(false, true)
|
||||||
api.nvim_buf_set_name(M.bufs[type], 'vim._extui.' .. type)
|
|
||||||
if type == 'cmd' then
|
if type == 'cmd' then
|
||||||
-- Attach highlighter to the cmdline buffer.
|
-- Attach highlighter to the cmdline buffer.
|
||||||
local parser = assert(vim.treesitter.get_parser(M.bufs.cmd, 'vim', {}))
|
local parser = assert(vim.treesitter.get_parser(M.bufs.cmd, 'vim', {}))
|
||||||
M.cmd.highlighter = vim.treesitter.highlighter.new(parser)
|
M.cmd.highlighter = vim.treesitter.highlighter.new(parser)
|
||||||
elseif type == 'more' then
|
|
||||||
-- Close more window with `q`, same as `checkhealth`
|
|
||||||
api.nvim_buf_set_keymap(M.bufs.more, 'n', 'q', '<Cmd>wincmd c<CR>', {})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local setopt = false
|
|
||||||
if
|
if
|
||||||
not api.nvim_win_is_valid(M.wins[M.tab][type])
|
not api.nvim_win_is_valid(M.wins[M.tab][type])
|
||||||
or not api.nvim_win_get_config(M.wins[M.tab][type]).zindex -- no longer floating
|
or not api.nvim_win_get_config(M.wins[M.tab][type]).zindex -- no longer floating
|
||||||
@@ -81,6 +77,12 @@ function M.tab_check_wins()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if setopt then
|
if setopt then
|
||||||
|
api.nvim_buf_set_name(M.bufs[type], 'vim._extui.' .. type)
|
||||||
|
if type == 'more' then
|
||||||
|
-- Close more window with `q`, same as `checkhealth`
|
||||||
|
api.nvim_buf_set_keymap(M.bufs.more, 'n', 'q', '<Cmd>wincmd c<CR>', {})
|
||||||
|
end
|
||||||
|
|
||||||
-- Fire a FileType autocommand with window context to let the user reconfigure local options.
|
-- Fire a FileType autocommand with window context to let the user reconfigure local options.
|
||||||
api.nvim_win_call(M.wins[M.tab][type], function()
|
api.nvim_win_call(M.wins[M.tab][type], function()
|
||||||
api.nvim_set_option_value('wrap', true, { scope = 'local' })
|
api.nvim_set_option_value('wrap', true, { scope = 'local' })
|
||||||
|
|||||||
Reference in New Issue
Block a user