fix: open where :CI was asked from #36
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/open-in-the-window-you-asked-from"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Checklist
Problem
:CIresolves its target over the network — about 700ms for a revision — andthen opened the buffer in whatever window was current when the answer arrived.
Move in the meantime and it lands on top of the buffer you moved to.
Same shape as the
TermClosehandoff removed in #34: a deferred open taking awindow that is no longer the one you asked from.
Solution
Remember the window at invocation, return to it before opening, and fall back
to the current one if it has since closed.
nvim_win_callwould have been the obvious tool and is wrong here: it restoresthe previous window on return, which would undo
M.open's jump to a windowalready showing the buffer. Setting the current window plainly is both simpler
and correct, since landing in the buffer you asked for is the point.