summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-07 18:12:18 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-07 18:12:18 +0200
commit8ce4b7ed85a7c6499bea5eb1312c85ee7a00e364 (patch)
tree5c531adcb869614cd6ed9d7e26fb4c7a9f198275 /src/quickfix.c
parent9470a4d88acf948af1596101527b3a505f8c14e9 (diff)
downloadvim-git-8ce4b7ed85a7c6499bea5eb1312c85ee7a00e364.tar.gz
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match filev8.2.1384
Problem: No ATTENTION prompt for :vimgrep first match file. Solution: When there is an existing swap file do not keep the dummy buffer. (closes #6649)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 1901e3806..99b0169ea 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -6016,6 +6016,23 @@ vgr_process_args(
}
/*
+ * Return TRUE if "buf" had an existing swap file, the current swap file does
+ * not end in ".swp".
+ */
+ static int
+existing_swapfile(buf_T *buf)
+{
+ if (buf->b_ml.ml_mfp != NULL)
+ {
+ char_u *fname = buf->b_ml.ml_mfp->mf_fname;
+ size_t len = STRLEN(fname);
+
+ return fname[len - 1] != 'p' || fname[len - 2] != 'w';
+ }
+ return FALSE;
+}
+
+/*
* Search for a pattern in a list of files and populate the quickfix list with
* the matches.
*/
@@ -6125,7 +6142,8 @@ vgr_process_files(
buf = NULL;
}
else if (buf != *first_match_buf
- || (cmd_args->flags & VGR_NOJUMP))
+ || (cmd_args->flags & VGR_NOJUMP)
+ || existing_swapfile(buf))
{
unload_dummy_buffer(buf, dirname_start);
// Keeping the buffer, remove the dummy flag.