summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-19 21:01:05 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-19 21:01:05 +0200
commitb40c2576d4e0e2dd2c580414c45947d88556d76d (patch)
treee6395518788a7f64a912bfd63b8eb8476ca195c0
parent7eed964b4196b0bfc6cf09dc449f0b9650b2d31e (diff)
downloadvim-git-b40c2576d4e0e2dd2c580414c45947d88556d76d.tar.gz
patch 8.1.2187: error for bad regexp even though regexp is not usedv8.1.2187
Problem: Error for bad regexp even though regexp is not used when writing a file. (Arseny Nasokin) Solution: Ignore regexp errors. (closes #5059)
-rw-r--r--src/cmdexpand.c2
-rw-r--r--src/ex_docmd.c3
-rw-r--r--src/testdir/test_writefile.vim7
-rw-r--r--src/version.c2
4 files changed, 12 insertions, 2 deletions
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index b3f18c6de..7381b0e9b 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -1976,6 +1976,8 @@ 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/ex_docmd.c b/src/ex_docmd.c
index 4dd7ba23d..1d0476946 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4211,7 +4211,8 @@ expand_filename(
else /* n == 2 */
{
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/testdir/test_writefile.vim b/src/testdir/test_writefile.vim
index 4b0a6d6c7..8eb2e7809 100644
--- a/src/testdir/test_writefile.vim
+++ b/src/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"))
diff --git a/src/version.c b/src/version.c
index 65979b253..c55af5ab5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2187,
+/**/
2186,
/**/
2185,