mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch:8.1.0337: :file fails in quickfix command (#9215)
Problem:    :file fails in quickfix command.
Solution:   Allow :file without argument when curbuf_lock is set. (Jason
            Franklin)
379fb76b08
			
			
This commit is contained in:
		 Jan Edmund Lazo
					Jan Edmund Lazo
				
			
				
					committed by
					
						 Justin M. Keyes
						Justin M. Keyes
					
				
			
			
				
	
			
			
			 Justin M. Keyes
						Justin M. Keyes
					
				
			
						parent
						
							16bc1e9c17
						
					
				
				
					commit
					18435a2534
				
			| @@ -1804,15 +1804,19 @@ static char_u * do_one_cmd(char_u **cmdlinep, | |||||||
|       errormsg = (char_u *)_(get_text_locked_msg()); |       errormsg = (char_u *)_(get_text_locked_msg()); | ||||||
|       goto doend; |       goto doend; | ||||||
|     } |     } | ||||||
|     /* Disallow editing another buffer when "curbuf_lock" is set. |  | ||||||
|      * Do allow ":edit" (check for argument later). |     // Disallow editing another buffer when "curbuf_lock" is set. | ||||||
|      * Do allow ":checktime" (it's postponed). */ |     // Do allow ":checktime" (it is postponed). | ||||||
|  |     // Do allow ":edit" (check for an argument later). | ||||||
|  |     // Do allow ":file" with no arguments (check for an argument later). | ||||||
|     if (!(ea.argt & CMDWIN) |     if (!(ea.argt & CMDWIN) | ||||||
|         && ea.cmdidx != CMD_edit |  | ||||||
|         && ea.cmdidx != CMD_checktime |         && ea.cmdidx != CMD_checktime | ||||||
|  |         && ea.cmdidx != CMD_edit | ||||||
|  |         && ea.cmdidx != CMD_file | ||||||
|         && !IS_USER_CMDIDX(ea.cmdidx) |         && !IS_USER_CMDIDX(ea.cmdidx) | ||||||
|         && curbuf_locked()) |         && curbuf_locked()) { | ||||||
|       goto doend; |       goto doend; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { |     if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { | ||||||
|       /* no range allowed */ |       /* no range allowed */ | ||||||
| @@ -1884,6 +1888,11 @@ static char_u * do_one_cmd(char_u **cmdlinep, | |||||||
|   else |   else | ||||||
|     ea.arg = skipwhite(p); |     ea.arg = skipwhite(p); | ||||||
|  |  | ||||||
|  |   // ":file" cannot be run with an argument when "curbuf_lock" is set | ||||||
|  |   if (ea.cmdidx == CMD_file && *ea.arg != NUL && curbuf_locked()) { | ||||||
|  |     goto doend; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* |   /* | ||||||
|    * Check for "++opt=val" argument. |    * Check for "++opt=val" argument. | ||||||
|    * Must be first, allow ":w ++enc=utf8 !cmd" |    * Must be first, allow ":w ++enc=utf8 !cmd" | ||||||
|   | |||||||
| @@ -2235,6 +2235,35 @@ func Test_cclose_in_autocmd() | |||||||
|   " call test_override('starting', 0) |   " call test_override('starting', 0) | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
|  | " Check that ":file" without an argument is possible even when "curbuf_lock" | ||||||
|  | " is set. | ||||||
|  | func Test_file_from_copen() | ||||||
|  |   " Works without argument. | ||||||
|  |   augroup QF_Test | ||||||
|  |     au! | ||||||
|  |     au FileType qf file | ||||||
|  |   augroup END | ||||||
|  |   copen | ||||||
|  |  | ||||||
|  |   augroup QF_Test | ||||||
|  |     au! | ||||||
|  |   augroup END | ||||||
|  |   cclose | ||||||
|  |  | ||||||
|  |   " Fails with argument. | ||||||
|  |   augroup QF_Test | ||||||
|  |     au! | ||||||
|  |     au FileType qf call assert_fails(':file foo', 'E788') | ||||||
|  |   augroup END | ||||||
|  |   copen | ||||||
|  |   augroup QF_Test | ||||||
|  |     au! | ||||||
|  |   augroup END | ||||||
|  |   cclose | ||||||
|  |  | ||||||
|  |   augroup! QF_Test | ||||||
|  | endfunction | ||||||
|  |  | ||||||
| func Test_resize_from_copen() | func Test_resize_from_copen() | ||||||
|     augroup QF_Test |     augroup QF_Test | ||||||
| 	au! | 	au! | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user