mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-07 04:08:25 +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,
|
buffer = self.buf,
|
||||||
callback = function()
|
callback = function()
|
||||||
local item = self:find(vim.api.nvim_win_get_cursor(self.win), last)
|
local item = self:find(vim.api.nvim_win_get_cursor(self.win), last)
|
||||||
if not item then -- can happen for panes without actionable items
|
-- can happen for panes without actionable items
|
||||||
for _, it in ipairs(self.items) do
|
item = item or vim.tbl_filter(function(it)
|
||||||
if it.action then
|
return it.action and it._
|
||||||
item = it
|
end, self.items)[1]
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if item then
|
if item then
|
||||||
local col = self.lines[item._.row]:find("[%w%d%p]", item._.col + 1)
|
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))
|
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