diff src/ex_docmd.c @ 14648:c3222a7342ab v8.1.0337

patch 8.1.0337: :file fails in quickfix command commit https://github.com/vim/vim/commit/379fb76b080521f7c09265ec3264b9e698923518 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 30 15:58:28 2018 +0200 patch 8.1.0337: :file fails in quickfix command Problem: :file fails in quickfix command. Solution: Allow :file without argument when curbuf_lock is set. (Jason Franklin)
author Christian Brabandt <cb@256bit.org>
date Thu, 30 Aug 2018 16:00:08 +0200
parents 22248c686b32
children 7771a1ff8b99
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2039,12 +2039,15 @@ do_one_cmd(
 	    errormsg = (char_u *)_(get_text_locked_msg());
 	    goto doend;
 	}
+
 	/* Disallow editing another buffer when "curbuf_lock" is set.
-	 * Do allow ":edit" (check for argument later).
-	 * 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)
+		&& ea.cmdidx != CMD_checktime
 		&& ea.cmdidx != CMD_edit
-		&& ea.cmdidx != CMD_checktime
+		&& ea.cmdidx != CMD_file
 		&& !IS_USER_CMDIDX(ea.cmdidx)
 		&& curbuf_locked())
 	    goto doend;
@@ -2130,6 +2133,10 @@ do_one_cmd(
     else
 	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.
      * Must be first, allow ":w ++enc=utf8 !cmd"