Skip to content

Commit

Permalink
fix: return cursor to source window when closing aerial (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Apr 17, 2023
1 parent 3d8360f commit a2beef7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lua/aerial/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ end

M.close = function()
if util.is_aerial_buffer() then
local source_win = util.get_source_win(0)
vim.api.nvim_win_close(0, false)
if source_win then
vim.api.nvim_set_current_win(source_win)
end
else
local aer_win = util.get_aerial_win()
if aer_win then
Expand Down Expand Up @@ -327,12 +331,7 @@ M.focus = function()
end

M.toggle = function(focus, direction)
if util.is_aerial_buffer() then
vim.api.nvim_win_close(0, false)
return false
end

if M.is_open() then
if util.is_aerial_buffer() or M.is_open() then
M.close()
return false
else
Expand Down

0 comments on commit a2beef7

Please sign in to comment.