Skip to content

Commit

Permalink
fix(sources.path): source buf not restored when mouse moves off sub menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Bekaboo committed Jan 17, 2025
1 parent 7b8b13a commit d3ddf49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lua/dropbar/sources/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,15 @@ end

---@param sym dropbar_symbol_t
local function preview_restore_view(sym)
if not sym.win then
if not sym.win or not sym.entry or not sym.entry.menu then
return
end
if sym.entry.menu.prev_buf then
vim.api.nvim_win_set_buf(sym.win, sym.entry.menu.prev_buf)

local source_buf = sym.entry.menu:root().prev_buf
if source_buf and vim.api.nvim_buf_is_valid(source_buf) then
vim.api.nvim_win_set_buf(sym.win, source_buf)
end

if sym.view then
vim.api.nvim_win_call(sym.win, function()
vim.fn.winrestview(sym.view)
Expand Down

0 comments on commit d3ddf49

Please sign in to comment.