patch 9.1.1376: quickfix dummy buffer may remain as dummy buffer Commit: https://github.com/vim/vim/commit/270124f46ae6266ac7eee871e28d3072dd7d5a92 Author: Sean Dewar <6256228+seande...@users.noreply.github.com> Date: Sat May 10 14:33:28 2025 +0200
patch 9.1.1376: quickfix dummy buffer may remain as dummy buffer Problem: when failing to wipeout a quickfix dummy buffer, it will remain as a dummy buffer, despite being kept. Solution: clear its dummy BF_DUMMY flag in this case (Sean Dewar). closes: #17283 Signed-off-by: Sean Dewar <6256228+seande...@users.noreply.github.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/quickfix.c b/src/quickfix.c index 9fe79784f..9c5ad9381 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -7078,7 +7078,7 @@ wipe_dummy_buffer(buf_T *buf, char_u *dirname_start) break; } if (!did_one) - return; + goto fail; } if (curbuf != buf && buf->b_nwindows == 0) // safety check @@ -7102,7 +7102,13 @@ wipe_dummy_buffer(buf_T *buf, char_u *dirname_start) if (dirname_start != NULL) // When autocommands/'autochdir' option changed directory: go back. restore_start_dir(dirname_start); + + return; } + +fail: + // Keeping the buffer, remove the dummy flag. + buf->b_flags &= ~BF_DUMMY; } /* diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index df4cc8011..fe85887e5 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -6921,4 +6921,23 @@ func Test_vimgrep_dummy_buffer_crash() %bw! endfunc +func Test_vimgrep_dummy_buffer_keep() + augroup DummyKeep + autocmd! + " Trigger a wipe of the dummy buffer by aborting script processing. Prevent + " wiping it by splitting it from the autocmd window into an only window. + autocmd BufReadCmd * ++once let s:dummy_buf = bufnr() + \| tab split | call interrupt() + augroup END + + call assert_fails('vimgrep /./ .') + call assert_equal(1, bufexists(s:dummy_buf)) + " Ensure it's no longer considered a dummy; should be able to switch to it. + execute s:dummy_buf 'sbuffer' + + unlet! s:dummy_buf + autocmd! DummyKeep + %bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 11d75207a..7547f0a58 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1376, /**/ 1375, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uDjZg-001wrl-Nt%40256bit.org.