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)
b40c2576d4
This commit is contained in:
Jan Edmund Lazo 2020-02-12 21:33:51 -05:00
parent 5e38516a46
commit 986eafce47
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
3 changed files with 10 additions and 2 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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"))