diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2018-11-09 03:33:28 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-11-09 09:33:28 +0100 |
commit | 18435a25347eeecb0886281d278c060aa7f82f6c (patch) | |
tree | 960c021db06ee706866e3c536c9aa1bc2f37b055 /src/nvim/ex_docmd.c | |
parent | 16bc1e9c17824e3a68f3b93152fc6f98583f6d58 (diff) | |
download | rneovim-18435a25347eeecb0886281d278c060aa7f82f6c.tar.gz rneovim-18435a25347eeecb0886281d278c060aa7f82f6c.tar.bz2 rneovim-18435a25347eeecb0886281d278c060aa7f82f6c.zip |
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)
https://github.com/vim/vim/commit/379fb76b080521f7c09265ec3264b9e698923518
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6ac7656a2f..6361267d9b 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1804,15 +1804,19 @@ static char_u * do_one_cmd(char_u **cmdlinep, 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). */ + + // Disallow editing another buffer when "curbuf_lock" is set. + // 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_edit && ea.cmdidx != CMD_checktime + && ea.cmdidx != CMD_edit + && ea.cmdidx != CMD_file && !IS_USER_CMDIDX(ea.cmdidx) - && curbuf_locked()) + && curbuf_locked()) { goto doend; + } if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { /* no range allowed */ @@ -1884,6 +1888,11 @@ static char_u * do_one_cmd(char_u **cmdlinep, 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" |