The function open_floating_window returns win, border_window, what is incorrect.
As result, in callback on_exit, vim.api.nvim_buf_is_valid(buffer) is false, and LazyGit terminal buffer persists as orphan (and hidden) with text [Process exited 0].
Every time LazyGit exits, an orphan terminal buffer remains , which can be checked, e.g. in Neo-tree:
This PR provides a fix to return LAZYGIT_BUFFER instead of border_window, so that the behavior is correct with no issues on my side.
In fact, it is not clear for me, why LAZYGIT_BUFFER is present, it is always set to nil in on_exit callback, probably some refactoring is required to remove LAZYGIT_BUFFER and LAZYGIT_LOADED and use local variables for corresponding buffer.
I believe it was used in old code, but after a few PRs by contributors it wasn't required any more. I need to look into this and do the refactoring as you mentioned.
The function open_floating_window returns
win, border_window
, what is incorrect. As result, in callback on_exit,vim.api.nvim_buf_is_valid(buffer)
isfalse
, and LazyGit terminal buffer persists as orphan (and hidden) with text[Process exited 0]
.Every time LazyGit exits, an orphan terminal buffer remains , which can be checked, e.g. in Neo-tree:
This PR provides a fix to return
LAZYGIT_BUFFER
instead ofborder_window
, so that the behavior is correct with no issues on my side.In fact, it is not clear for me, why
LAZYGIT_BUFFER
is present, it is always set tonil
in on_exit callback, probably some refactoring is required to removeLAZYGIT_BUFFER
andLAZYGIT_LOADED
and use local variables for corresponding buffer.