diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-30 15:58:28 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-30 15:58:28 +0200 |
commit | 379fb76b080521f7c09265ec3264b9e698923518 (patch) | |
tree | 412bef14f2a40f30daf3d42393189c1c34c22989 | |
parent | dd5d18eadffadc723ff7d3e208a2973d267a6dde (diff) | |
download | vim-git-379fb76b080521f7c09265ec3264b9e698923518.tar.gz |
patch 8.1.0337: :file fails in quickfix commandv8.1.0337
Problem: :file fails in quickfix command.
Solution: Allow :file without argument when curbuf_lock is set. (Jason
Franklin)
-rw-r--r-- | src/ex_docmd.c | 13 | ||||
-rw-r--r-- | src/testdir/test_quickfix.vim | 29 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 41 insertions, 3 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index c8a1c3f23..5b53785cc 100644 --- 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_edit && ea.cmdidx != CMD_checktime + && ea.cmdidx != CMD_edit + && 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" diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 6063fd63c..36982c229 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -2485,6 +2485,35 @@ func Test_cclose_in_autocmd() call test_override('starting', 0) 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() augroup QF_Test au! diff --git a/src/version.c b/src/version.c index baf005ea3..12c86aaba 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 337, +/**/ 336, /**/ 335, |