Mercurial > vim
comparison src/quickfix.c @ 21668:0843f244e547 v8.2.1384
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Commit: https://github.com/vim/vim/commit/8ce4b7ed85a7c6499bea5eb1312c85ee7a00e364
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 7 18:12:18 2020 +0200
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 07 Aug 2020 18:15:06 +0200 |
parents | 4dfd00f481fb |
children | d8065205ea82 |
comparison
equal
deleted
inserted
replaced
21667:9bf8c137308b | 21668:0843f244e547 |
---|---|
6014 | 6014 |
6015 return OK; | 6015 return OK; |
6016 } | 6016 } |
6017 | 6017 |
6018 /* | 6018 /* |
6019 * Return TRUE if "buf" had an existing swap file, the current swap file does | |
6020 * not end in ".swp". | |
6021 */ | |
6022 static int | |
6023 existing_swapfile(buf_T *buf) | |
6024 { | |
6025 if (buf->b_ml.ml_mfp != NULL) | |
6026 { | |
6027 char_u *fname = buf->b_ml.ml_mfp->mf_fname; | |
6028 size_t len = STRLEN(fname); | |
6029 | |
6030 return fname[len - 1] != 'p' || fname[len - 2] != 'w'; | |
6031 } | |
6032 return FALSE; | |
6033 } | |
6034 | |
6035 /* | |
6019 * Search for a pattern in a list of files and populate the quickfix list with | 6036 * Search for a pattern in a list of files and populate the quickfix list with |
6020 * the matches. | 6037 * the matches. |
6021 */ | 6038 */ |
6022 static int | 6039 static int |
6023 vgr_process_files( | 6040 vgr_process_files( |
6123 { | 6140 { |
6124 wipe_dummy_buffer(buf, dirname_start); | 6141 wipe_dummy_buffer(buf, dirname_start); |
6125 buf = NULL; | 6142 buf = NULL; |
6126 } | 6143 } |
6127 else if (buf != *first_match_buf | 6144 else if (buf != *first_match_buf |
6128 || (cmd_args->flags & VGR_NOJUMP)) | 6145 || (cmd_args->flags & VGR_NOJUMP) |
6146 || existing_swapfile(buf)) | |
6129 { | 6147 { |
6130 unload_dummy_buffer(buf, dirname_start); | 6148 unload_dummy_buffer(buf, dirname_start); |
6131 // Keeping the buffer, remove the dummy flag. | 6149 // Keeping the buffer, remove the dummy flag. |
6132 buf->b_flags &= ~BF_DUMMY; | 6150 buf->b_flags &= ~BF_DUMMY; |
6133 buf = NULL; | 6151 buf = NULL; |