Skip to content

Commit

Permalink
fix(hint.statusline): Restore correct window if it changed
Browse files Browse the repository at this point in the history
When the Hydra takes the user to a different window, we need to restore
the status line of the old window where the hint is shown.
  • Loading branch information
Frederick888 committed Dec 31, 2023
1 parent ef9544f commit d0e2fea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/hydra/hint/statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ function HintStatusLine:show()
statusline = table.concat(statusline) ---@diagnostic disable-line

self.original_statusline = vim.wo.statusline
self.winid = vim.api.nvim_get_current_win()
vim.wo.statusline = statusline
end

function HintStatusLine:close()
if self.original_statusline then
vim.wo.statusline = self.original_statusline
if vim.tbl_contains(vim.api.nvim_list_wins(), self.winid) then
vim.wo[self.winid].statusline = self.original_statusline
end
self.original_statusline = nil
end
end
Expand Down

0 comments on commit d0e2fea

Please sign in to comment.