fix(status): Show code window active when no outline opened yet

This commit is contained in:
hedy
2023-11-24 16:17:52 +08:00
parent b475574fc0
commit f4d5eb2dad

View File

@@ -163,11 +163,16 @@ function M.show_status()
end end
---@type outline.StatusContext ---@type outline.StatusContext
local ctx = { priority = cfg.o.providers.priority } local ctx = {
priority = cfg.o.providers.priority,
outline_open = is_open,
}
if vim.api.nvim_buf_is_valid(buf) then if vim.api.nvim_buf_is_valid(buf) then
ctx.ft = vim.api.nvim_buf_get_option(buf, 'ft') ctx.ft = vim.api.nvim_buf_get_option(buf, 'ft')
-- TODO: else?
end end
ctx.filter = cfg.o.symbols.user_config_filter[ctx.ft] ctx.filter = cfg.o.symbols.user_config_filter[ctx.ft]
ctx.default_filter = cfg.o.symbols.user_config_filter.default ctx.default_filter = cfg.o.symbols.user_config_filter.default
@@ -178,13 +183,12 @@ function M.show_status()
if p ~= nil then if p ~= nil then
ctx.provider = p ctx.provider = p
ctx.outline_open = false -- Just show code window is active when the first outline in this tabpage
if is_open then -- has not yet been opened.
ctx.outline_open = true if not sidebar then
end
ctx.code_win_active = false
if require('outline.preview').has_code_win(win) then
ctx.code_win_active = true ctx.code_win_active = true
else
ctx.code_win_active = require('outline.preview').has_code_win(win)
end end
end end