aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-02-12 21:33:51 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-02-16 07:49:44 -0500
commit986eafce4708c8f49552d7dcd0cc5fe471caa655 (patch)
treefd338dbbc51730bfdc29029708e71028800a1653
parent5e38516a462cf346e3379f68f4581afa22a9314c (diff)
downloadrneovim-986eafce4708c8f49552d7dcd0cc5fe471caa655.tar.gz
rneovim-986eafce4708c8f49552d7dcd0cc5fe471caa655.tar.bz2
rneovim-986eafce4708c8f49552d7dcd0cc5fe471caa655.zip
vim-patch:8.1.2187: error for bad regexp even though regexp is not used
Problem: Error for bad regexp even though regexp is not used when writing a file. (Arseny Nasokin) Solution: Ignore regexp errors. (closes vim/vim#5059) https://github.com/vim/vim/commit/b40c2576d4e0e2dd2c580414c45947d88556d76d
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/ex_getln.c3
-rw-r--r--src/nvim/testdir/test_writefile.vim7
3 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 12bee3ab86..d0193064b0 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -4373,7 +4373,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
if (has_wildcards) {
expand_T xpc;
- int options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
+ int options = WILD_LIST_NOTFOUND | WILD_NOERROR | WILD_ADD_SLASH;
ExpandInit(&xpc);
xpc.xp_context = EXPAND_FILES;
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index f6833874ea..1c3c212aef 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4693,6 +4693,9 @@ ExpandFromContext (
flags |= EW_KEEPALL;
if (options & WILD_SILENT)
flags |= EW_SILENT;
+ if (options & WILD_NOERROR) {
+ flags |= EW_NOERROR;
+ }
if (options & WILD_ALLLINKS) {
flags |= EW_ALLLINKS;
}
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim
index 6066d61af4..56031662a3 100644
--- a/src/nvim/testdir/test_writefile.vim
+++ b/src/nvim/testdir/test_writefile.vim
@@ -1,4 +1,4 @@
-" Tests for the writefile() function.
+" Tests for the writefile() function and some :write commands.
func Test_writefile()
let f = tempname()
@@ -16,6 +16,11 @@ func Test_writefile()
call delete(f)
endfunc
+func Test_writefile_ignore_regexp_error()
+ write Xt[z-a]est.txt
+ call delete('Xt[z-a]est.txt')
+endfunc
+
func Test_writefile_fails_gently()
call assert_fails('call writefile(["test"], "Xfile", [])', 'E730:')
call assert_false(filereadable("Xfile"))