mirror of https://github.com/folke/lazy.nvim.git
fix(ui): when closing details, jump to plugin header. Closes #1338
This commit is contained in:
parent
5bddef2415
commit
3772914075
|
@ -96,7 +96,17 @@ function M.create()
|
||||||
name = plugin.name,
|
name = plugin.name,
|
||||||
kind = plugin._.kind,
|
kind = plugin._.kind,
|
||||||
}
|
}
|
||||||
self.state.plugin = not vim.deep_equal(self.state.plugin, selected) and selected or nil
|
|
||||||
|
local open = not vim.deep_equal(self.state.plugin, selected)
|
||||||
|
|
||||||
|
if not open then
|
||||||
|
local row = self.render:get_row(selected)
|
||||||
|
if row then
|
||||||
|
vim.api.nvim_win_set_cursor(self.view.win, { row, 8 })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.state.plugin = open and selected or nil
|
||||||
self:update()
|
self:update()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -122,6 +122,15 @@ function M:get_plugin(row)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param selected {name:string, kind?: LazyPluginKind}
|
||||||
|
function M:get_row(selected)
|
||||||
|
for _, loc in ipairs(self.locations) do
|
||||||
|
if loc.kind == selected.kind and loc.name == selected.name then
|
||||||
|
return loc.from
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function M:title()
|
function M:title()
|
||||||
self:nl()
|
self:nl()
|
||||||
local modes = vim.tbl_filter(function(c)
|
local modes = vim.tbl_filter(function(c)
|
||||||
|
|
Loading…
Reference in New Issue