diff options
author | Matthieu Coudron <mattator@gmail.com> | 2020-04-13 22:49:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-13 22:49:00 +0200 |
commit | 93b2cb7a3824f91ee24ddf57406d5682699f684b (patch) | |
tree | 4ea7bb4aca7520a26a749b0958046ba52b450d4f /src/nvim/quickfix.c | |
parent | 13b4a6fd4fa67794e76892cb362121a33a756f58 (diff) | |
parent | cf223e7d78df5e8a63b84d423be55a29eefd8883 (diff) | |
download | rneovim-93b2cb7a3824f91ee24ddf57406d5682699f684b.tar.gz rneovim-93b2cb7a3824f91ee24ddf57406d5682699f684b.tar.bz2 rneovim-93b2cb7a3824f91ee24ddf57406d5682699f684b.zip |
Merge pull request #11997 from janlazo/vim-8.1.2389
[RDY]vim-patch:8.1.{1745,2147,2280,2282,},8.2.{41,134,365,366,381,387,389,397,398,406,415,457,464,473,474,507,544,549}
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index c444326533..484168e798 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -5134,6 +5134,7 @@ theend: // Restore current working directory to "dirname_start" if they differ, taking // into account whether it is set locally or globally. static void restore_start_dir(char_u *dirname_start) + FUNC_ATTR_NONNULL_ALL { char_u *dirname_now = xmalloc(MAXPATHL); @@ -5251,8 +5252,29 @@ load_dummy_buffer ( // directory to "dirname_start" prior to returning, if autocmds or the // 'autochdir' option have changed it. static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start) + FUNC_ATTR_NONNULL_ALL { - if (curbuf != buf) { // safety check + // If any autocommand opened a window on the dummy buffer, close that + // window. If we can't close them all then give up. + while (buf->b_nwindows > 0) { + bool did_one = false; + + if (firstwin->w_next != NULL) { + for (win_T *wp = firstwin; wp != NULL; wp = wp->w_next) { + if (wp->w_buffer == buf) { + if (win_close(wp, false) == OK) { + did_one = true; + } + break; + } + } + } + if (!did_one) { + return; + } + } + + if (curbuf != buf && buf->b_nwindows == 0) { // safety check cleanup_T cs; // Reset the error/interrupt/exception state here so that aborting() |