mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 19:28:24 +00:00
fix(dashboard): set cursor to non-hidden actionable items. Fixes #273
This commit is contained in:
parent
3cbbac0f83
commit
7c7b18fdee
1 changed files with 4 additions and 8 deletions
|
@ -712,14 +712,10 @@ function D:update()
|
|||
buffer = self.buf,
|
||||
callback = function()
|
||||
local item = self:find(vim.api.nvim_win_get_cursor(self.win), last)
|
||||
if not item then -- can happen for panes without actionable items
|
||||
for _, it in ipairs(self.items) do
|
||||
if it.action then
|
||||
item = it
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
-- can happen for panes without actionable items
|
||||
item = item or vim.tbl_filter(function(it)
|
||||
return it.action and it._
|
||||
end, self.items)[1]
|
||||
if item then
|
||||
local col = self.lines[item._.row]:find("[%w%d%p]", item._.col + 1)
|
||||
col = col or (item._.col + 1 + (item.indent and (item.indent + 1) or 0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue