Skip to content

Commit 6cd7448

Browse files
committed
Commit info popup issues
1. Close the commit info popup if full commit view is entered, otherwise it remains on the screen with no way to close it. 2. Check that the saved window is valid before attempting to reuse it. This triggering an error if the blame window got closed by pressing escape while commit info popup is shown.
1 parent f3f6153 commit 6cd7448

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lua/blame/commit_info.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function CommitInfo:close(cleanup)
2525
then
2626
vim.api.nvim_win_close(self.commit_info_window, true)
2727
end
28-
if self.saved_win and self.saved_pos then
28+
if self.saved_win and self.saved_pos and vim.api.nvim_win_is_valid(self.saved_win) then
2929
vim.api.nvim_set_current_win(self.saved_win)
3030
vim.api.nvim_win_set_cursor(self.saved_win, self.saved_pos)
3131
end

lua/blame/views/window_view.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ function WindowView:show_full_commit()
342342
local row, _ = unpack(vim.api.nvim_win_get_cursor(self.blame_window))
343343
local commit = self.blamed_lines[row]
344344
local view = self.config.commit_detail_view or "tab"
345+
if self.commit_info:is_open() == true then
346+
self.commit_info:close(false)
347+
end
345348
if type(view) == 'function' then
346349
local path = self.blame_stack_client.file_path
347350
view(commit.hash, row, path)

0 commit comments

Comments
 (0)