mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
feat(dashboard): when a section has a title, use that for action and key. If not put it in the section. Fixes #189
This commit is contained in:
parent
6e3b9546de
commit
045a17da06
1 changed files with 15 additions and 3 deletions
|
@ -482,7 +482,18 @@ function D:resolve(item, results, parent)
|
|||
|
||||
-- add the title if there are child items
|
||||
if #results >= first_child and item.title then
|
||||
table.insert(results, first_child, { title = item.title, icon = item.icon, pane = item.pane })
|
||||
table.insert(results, first_child, {
|
||||
title = item.title,
|
||||
icon = item.icon,
|
||||
pane = item.pane,
|
||||
action = item.action,
|
||||
key = item.key,
|
||||
label = item.label,
|
||||
})
|
||||
item.action = nil
|
||||
item.label = nil
|
||||
item.key = nil
|
||||
first_child = first_child + 1
|
||||
end
|
||||
|
||||
if item.gap then -- add padding between child items
|
||||
|
@ -992,8 +1003,9 @@ function M.sections.terminal(opts)
|
|||
end
|
||||
end
|
||||
return {
|
||||
action = opts.action,
|
||||
key = opts.key,
|
||||
action = not opts.title and opts.action or nil,
|
||||
key = not opts.title and opts.key or nil,
|
||||
label = not opts.title and opts.label or nil,
|
||||
render = function(_, pos)
|
||||
self:trace("terminal.render")
|
||||
local win = vim.api.nvim_open_win(buf, false, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue