mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-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: vim/vim#17283
270124f46a
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
(cherry picked from commit d95b0a5396)
			
			
This commit is contained in:
		| @@ -5837,7 +5837,7 @@ static void wipe_dummy_buffer(buf_T *buf, char *dirname_start) | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     if (!did_one) { |     if (!did_one) { | ||||||
|       return; |       goto fail; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -5859,7 +5859,13 @@ static void wipe_dummy_buffer(buf_T *buf, char *dirname_start) | |||||||
|       // When autocommands/'autochdir' option changed directory: go back. |       // When autocommands/'autochdir' option changed directory: go back. | ||||||
|       restore_start_dir(dirname_start); |       restore_start_dir(dirname_start); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     return; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | fail: | ||||||
|  |   // Keeping the buffer, remove the dummy flag. | ||||||
|  |   buf->b_flags &= ~BF_DUMMY; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Unload the dummy buffer that load_dummy_buffer() created. Restores | /// Unload the dummy buffer that load_dummy_buffer() created. Restores | ||||||
|   | |||||||
| @@ -6618,4 +6618,23 @@ func Test_vimgrep_dummy_buffer_crash() | |||||||
|   %bw! |   %bw! | ||||||
| endfunc | 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 | " vim: shiftwidth=2 sts=2 expandtab | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sean Dewar
					Sean Dewar