diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-03-17 02:09:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-17 02:09:06 +0100 |
commit | 7c38994ff2397772234bd89faf8b372fa9fecfbd (patch) | |
tree | 643aa51ddeaf8e8c1a5f25ae4f1ac6b3036b1f29 /src/nvim/fileio.c | |
parent | 32998731bf19df219b8d3140943cfffe643573a5 (diff) | |
download | rneovim-7c38994ff2397772234bd89faf8b372fa9fecfbd.tar.gz rneovim-7c38994ff2397772234bd89faf8b372fa9fecfbd.tar.bz2 rneovim-7c38994ff2397772234bd89faf8b372fa9fecfbd.zip |
aucmd_prepbuf: also restore `prevwin` #9741
bisected to f5d5da391715
Other test steps:
nvim -u NORC
:terminal tree / " Produces lots of output
:edit somefile.txt
:vsplit
:vsplit
<c-w>l
<c-w>l
<c-w>h
<c-w>p
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 7be4107c94..53b945d983 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -6527,6 +6527,7 @@ aucmd_prepbuf ( win = curwin; aco->save_curwin = curwin; + aco->save_prevwin = prevwin; aco->save_curbuf = curbuf; if (win != NULL) { /* There is a window for "buf" in the current tab page, make it the @@ -6624,6 +6625,8 @@ win_found: // Hmm, original window disappeared. Just use the first one. curwin = firstwin; } + prevwin = win_valid(aco->save_prevwin) ? aco->save_prevwin + : firstwin; // window disappeared? vars_clear(&aucmd_win->w_vars->dv_hashtab); // free all w: variables hash_init(&aucmd_win->w_vars->dv_hashtab); // re-use the hashtab curbuf = curwin->w_buffer; @@ -6656,6 +6659,8 @@ win_found: } curwin = aco->save_curwin; + prevwin = win_valid(aco->save_prevwin) ? aco->save_prevwin + : firstwin; // window disappeared? curbuf = curwin->w_buffer; // In case the autocommand moves the cursor to a position that does not // exist in curbuf |