I am trying to fix a bug that goes like this:
- [cursor in ordinary window] open preview window and move to it
- [cursor in preview window] close preview window
- expected: cursor moves to where it was in step 1
- actual: cursor ends up in another window
I always thought that when you're in a window and you close it, whether or not it's the preview window, the cursor moves to whichever window it was in before that window. Is that correct? If not, how does Vim decide which window to put the cursor in?
It doesn't seem to be related to the window's alternate file, nor to 'splitbelow'
and 'splitright'
.
It does seem to be related to whether the preview window is opened with a "position modifier", e.g. :bo pedit x
vs :pedit x
. The position modifier seems to cause the unexpected behaviour.