From da440d21a6b94d7f525fa7be9b1417c78dd9aa4c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 21:27:23 +0100 Subject: [PATCH 01/16] patch 7.4.1107 Problem: Vim can create a directory but not delete it. Solution: Add an argument to delete() to make it possible to delete a directory, also recursively. --- runtime/doc/eval.txt | 26 ++++++++++++---- src/eval.c | 33 ++++++++++++++++++-- src/fileio.c | 60 ++++++++++++++++++++++++++----------- src/proto/fileio.pro | 1 + src/testdir/test_alot.vim | 1 + src/testdir/test_delete.vim | 36 ++++++++++++++++++++++ src/version.c | 2 ++ 7 files changed, 133 insertions(+), 26 deletions(-) create mode 100644 src/testdir/test_delete.vim diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 35a12df6e4..6edd3f5411 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2016 Jan 15 +*eval.txt* For Vim version 7.4. Last change: 2016 Jan 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -919,6 +919,11 @@ just above, except that indexes out of range cause an error. Examples: > Using expr8[expr1] or expr8[expr1a : expr1b] on a |Funcref| results in an error. +Watch out for confusion between a namespace and a variable followed by a colon +for a sublist: > + mylist[n:] " uses variable n + mylist[s:] " uses namespace s:, error! + expr8.name entry in a |Dictionary| *expr-entry* @@ -1794,7 +1799,7 @@ cursor( {lnum}, {col} [, {off}]) Number move cursor to {lnum}, {col}, {off} cursor( {list}) Number move cursor to position in {list} deepcopy( {expr} [, {noref}]) any make a full copy of {expr} -delete( {fname}) Number delete file {fname} +delete( {fname} [, {flags}]) Number delete the file or directory {fname} did_filetype() Number TRUE if FileType autocommand event used diff_filler( {lnum}) Number diff filler lines about {lnum} diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col} @@ -2748,10 +2753,19 @@ deepcopy({expr}[, {noref}]) *deepcopy()* *E698* {noref} set to 1 will fail. Also see |copy()|. -delete({fname}) *delete()* - Deletes the file by the name {fname}. The result is a Number, - which is 0 if the file was deleted successfully, and non-zero - when the deletion failed. +delete({fname} [, {flags}]) *delete()* + Without {flags} or with {flags} empty: Deletes the file by the + name {fname}. + + When {flags} is "d": Deletes the directory by the name + {fname}. This fails when {fname} is not empty. + + When {flags} is "rf": Deletes the directory by the name + {fname} and everything in it, recursively. Be careful! + + The result is a Number, which is 0 if the delete operation was + successful and -1 when the deletion failed or partly failed. + Use |remove()| to delete an item from a |List|. To delete a line from the buffer use |:delete|. Use |:exe| when the line number is in a variable. diff --git a/src/eval.c b/src/eval.c index d4e3b9ef59..c61b64dd60 100644 --- a/src/eval.c +++ b/src/eval.c @@ -8131,7 +8131,7 @@ static struct fst {"cscope_connection",0,3, f_cscope_connection}, {"cursor", 1, 3, f_cursor}, {"deepcopy", 1, 2, f_deepcopy}, - {"delete", 1, 1, f_delete}, + {"delete", 1, 2, f_delete}, {"did_filetype", 0, 0, f_did_filetype}, {"diff_filler", 1, 1, f_diff_filler}, {"diff_hlID", 2, 2, f_diff_hlID}, @@ -10391,10 +10391,37 @@ f_delete(argvars, rettv) typval_T *argvars; typval_T *rettv; { + char_u nbuf[NUMBUFLEN]; + char_u *name; + char_u *flags; + + rettv->vval.v_number = -1; if (check_restricted() || check_secure()) - rettv->vval.v_number = -1; + return; + + name = get_tv_string(&argvars[0]); + if (name == NULL || *name == NUL) + { + EMSG(_(e_invarg)); + return; + } + + if (argvars[1].v_type != VAR_UNKNOWN) + flags = get_tv_string_buf(&argvars[1], nbuf); else - rettv->vval.v_number = mch_remove(get_tv_string(&argvars[0])); + flags = (char_u *)""; + + if (*flags == NUL) + /* delete a file */ + rettv->vval.v_number = mch_remove(name) == 0 ? 0 : -1; + else if (STRCMP(flags, "d") == 0) + /* delete an empty directory */ + rettv->vval.v_number = mch_rmdir(name) == 0 ? 0 : -1; + else if (STRCMP(flags, "rf") == 0) + /* delete an directory recursively */ + rettv->vval.v_number = delete_recursive(name); + else + EMSG2(_(e_invexpr2), flags); } /* diff --git a/src/fileio.c b/src/fileio.c index 75a38764c3..6dbdea21e6 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7280,6 +7280,46 @@ write_lnum_adjust(offset) curbuf->b_no_eol_lnum += offset; } +#if defined(TEMPDIRNAMES) || defined(FEAT_EVAL) || defined(PROTO) +/* + * Delete "name" and everything in it, recursively. + * return 0 for succes, -1 if some file was not deleted. + */ + int +delete_recursive(char_u *name) +{ + int result = 0; + char_u **files; + int file_count; + int i; + char_u *exp; + + if (mch_isdir(name)) + { + vim_snprintf((char *)NameBuff, MAXPATHL, "%s/*", name); + exp = vim_strsave(NameBuff); + if (exp == NULL) + return -1; + if (gen_expand_wildcards(1, &exp, &file_count, &files, + EW_DIR|EW_FILE|EW_SILENT) == OK) + { + for (i = 0; i < file_count; ++i) + if (delete_recursive(files[i]) != 0) + result = -1; + FreeWild(file_count, files); + } + else + result = -1; + vim_free(exp); + (void)mch_rmdir(name); + } + else + result = mch_remove(name) == 0 ? 0 : -1; + + return result; +} +#endif + #if defined(TEMPDIRNAMES) || defined(PROTO) static long temp_count = 0; /* Temp filename counter. */ @@ -7289,30 +7329,16 @@ static long temp_count = 0; /* Temp filename counter. */ void vim_deltempdir() { - char_u **files; - int file_count; - int i; - if (vim_tempdir != NULL) { - sprintf((char *)NameBuff, "%s*", vim_tempdir); - if (gen_expand_wildcards(1, &NameBuff, &file_count, &files, - EW_DIR|EW_FILE|EW_SILENT) == OK) - { - for (i = 0; i < file_count; ++i) - mch_remove(files[i]); - FreeWild(file_count, files); - } - gettail(NameBuff)[-1] = NUL; - (void)mch_rmdir(NameBuff); - + /* remove the trailing path separator */ + gettail(vim_tempdir)[-1] = NUL; + delete_recursive(vim_tempdir); vim_free(vim_tempdir); vim_tempdir = NULL; } } -#endif -#ifdef TEMPDIRNAMES /* * Directory "tempdir" was created. Expand this name to a full path and put * it in "vim_tempdir". This avoids that using ":cd" would confuse us. diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro index 32d7bce318..0f68a20c4a 100644 --- a/src/proto/fileio.pro +++ b/src/proto/fileio.pro @@ -22,6 +22,7 @@ int buf_check_timestamp __ARGS((buf_T *buf, int focus)); void buf_reload __ARGS((buf_T *buf, int orig_mode)); void buf_store_time __ARGS((buf_T *buf, struct stat *st, char_u *fname)); void write_lnum_adjust __ARGS((linenr_T offset)); +int delete_recursive __ARGS((char_u *name)); void vim_deltempdir __ARGS((void)); char_u *vim_tempname __ARGS((int extra_char, int keep)); void forward_slash __ARGS((char_u *fname)); diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index 87bd26b458..3cd1f824ee 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -3,6 +3,7 @@ source test_backspace_opt.vim source test_cursor_func.vim +source test_delete.vim source test_lispwords.vim source test_menu.vim source test_searchpos.vim diff --git a/src/testdir/test_delete.vim b/src/testdir/test_delete.vim new file mode 100644 index 0000000000..6e2b9c86bb --- /dev/null +++ b/src/testdir/test_delete.vim @@ -0,0 +1,36 @@ +" Test for delete(). + +func Test_file_delete() + split Xfile + call setline(1, ['a', 'b']) + wq + call assert_equal(['a', 'b'], readfile('Xfile')) + call assert_equal(0, delete('Xfile')) + call assert_fails('call readfile("Xfile")', 'E484:') + call assert_equal(-1, delete('Xfile')) +endfunc + +func Test_dir_delete() + call mkdir('Xdir1') + call assert_true(isdirectory('Xdir1')) + call assert_equal(0, delete('Xdir1', 'd')) + call assert_false(isdirectory('Xdir1')) + call assert_equal(-1, delete('Xdir1', 'd')) +endfunc + +func Test_recursive_delete() + call mkdir('Xdir1') + call mkdir('Xdir1/subdir') + split Xdir1/Xfile + call setline(1, ['a', 'b']) + w + w Xdir1/subdir/Xfile + close + call assert_true(isdirectory('Xdir1')) + call assert_equal(['a', 'b'], readfile('Xdir1/Xfile')) + call assert_true(isdirectory('Xdir1/subdir')) + call assert_equal(['a', 'b'], readfile('Xdir1/subdir/Xfile')) + call assert_equal(0, delete('Xdir1', 'rf')) + call assert_false(isdirectory('Xdir1')) + call assert_equal(-1, delete('Xdir1', 'd')) +endfunc diff --git a/src/version.c b/src/version.c index efc77c0aa8..9c24efd0df 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1107, /**/ 1106, /**/ From 58adb14739fa240ca6020cede9ab1f1cb07bd90a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 21:50:51 +0100 Subject: [PATCH 02/16] patch 7.4.1108 Problem: Expanding "~" halfway a file name. Solution: Handle the file name as one name. (Marco Hinz) Add a test. Closes #564. --- src/Makefile | 5 ++++- src/misc2.c | 2 +- src/testdir/test27.in | 20 -------------------- src/testdir/test27.ok | 2 -- src/testdir/test_alot.vim | 1 + src/testdir/test_expand.vim | 36 ++++++++++++++++++++++++++++++++++++ src/version.c | 2 ++ 7 files changed, 44 insertions(+), 24 deletions(-) delete mode 100644 src/testdir/test27.in delete mode 100644 src/testdir/test27.ok create mode 100644 src/testdir/test_expand.vim diff --git a/src/Makefile b/src/Makefile index 42c86f30b5..4977d7cb27 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1975,12 +1975,15 @@ test1 \ test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \ test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \ test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \ - test100 test101 test102 test103 test104 test105 test106 test107: + test100 test101 test102 test103 test104 test105 test106 test107 test108: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) test_assert \ test_backspace_opt \ test_cdo \ + test_cursor_func \ + test_delete \ + test_expand \ test_hardcopy \ test_increment \ test_lispwords \ diff --git a/src/misc2.c b/src/misc2.c index 0ee57fc4a6..4e9e47357e 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -5543,7 +5543,7 @@ find_file_in_path_option(ptr, len, options, first, path_option, /* copy file name into NameBuff, expanding environment variables */ save_char = ptr[len]; ptr[len] = NUL; - expand_env(ptr, NameBuff, MAXPATHL); + expand_env_esc(ptr, NameBuff, MAXPATHL, FALSE, TRUE, NULL); ptr[len] = save_char; vim_free(ff_file_to_find); diff --git a/src/testdir/test27.in b/src/testdir/test27.in deleted file mode 100644 index 2df16d9eff..0000000000 --- a/src/testdir/test27.in +++ /dev/null @@ -1,20 +0,0 @@ -Test for expanding file names - -STARTTEST -:!mkdir Xdir1 -:!mkdir Xdir2 -:!mkdir Xdir3 -:cd Xdir3 -:!mkdir Xdir4 -:cd .. -:w Xdir1/file -:w Xdir3/Xdir4/file -:n Xdir?/*/file -Go%:.w! test.out -:n! Xdir?/*/nofile -Go%:.w >>test.out -:e! xx -:!rm -rf Xdir1 Xdir2 Xdir3 -:qa! -ENDTEST - diff --git a/src/testdir/test27.ok b/src/testdir/test27.ok deleted file mode 100644 index c35f2438a9..0000000000 --- a/src/testdir/test27.ok +++ /dev/null @@ -1,2 +0,0 @@ -Xdir3/Xdir4/file -Xdir?/*/nofile diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index 3cd1f824ee..e89afb49ad 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -4,6 +4,7 @@ source test_backspace_opt.vim source test_cursor_func.vim source test_delete.vim +source test_expand.vim source test_lispwords.vim source test_menu.vim source test_searchpos.vim diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim new file mode 100644 index 0000000000..fd999db1b7 --- /dev/null +++ b/src/testdir/test_expand.vim @@ -0,0 +1,36 @@ +" Test for expanding file names + +func Test_with_directories() + call mkdir('Xdir1') + call mkdir('Xdir2') + call mkdir('Xdir3') + cd Xdir3 + call mkdir('Xdir4') + cd .. + + split Xdir1/file + call setline(1, ['a', 'b']) + w + w Xdir3/Xdir4/file + close + + next Xdir?/*/file + call assert_equal('Xdir3/Xdir4/file', expand('%')) + next! Xdir?/*/nofile + call assert_equal('Xdir?/*/nofile', expand('%')) + + call delete('Xdir1', 'rf') + call delete('Xdir2', 'rf') + call delete('Xdir3', 'rf') +endfunc + +func Test_with_tilde() + let dir = getcwd() + call mkdir('Xdir ~ dir') + call assert_true(isdirectory('Xdir ~ dir')) + cd Xdir\ ~\ dir + call assert_true(getcwd() =~ 'Xdir \~ dir') + exe 'cd ' . fnameescape(dir) + call delete('Xdir ~ dir', 'd') + call assert_false(isdirectory('Xdir ~ dir')) +endfunc diff --git a/src/version.c b/src/version.c index 9c24efd0df..1a61df43a0 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1108, /**/ 1107, /**/ From 4cf7679383dca81a4a351e2b0ec333c95d6d9085 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 22:02:57 +0100 Subject: [PATCH 03/16] patch 7.4.1109 Problem: MS-Windows doesn't have rmdir(). Solution: Add mch_rmdir(). --- src/os_win32.c | 24 ++++++++++++++++++++++++ src/proto/os_win32.pro | 1 + src/version.c | 2 ++ 3 files changed, 27 insertions(+) diff --git a/src/os_win32.c b/src/os_win32.c index c5b23ca7db..a47ffaf18a 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -3153,6 +3153,30 @@ mch_mkdir(char_u *name) return _mkdir(name); } +/* + * Delete directory "name". + * Return 0 on success, -1 on error. + */ + int +mch_rmdir(char_u *name) +{ +#ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR *p; + int retval; + + p = enc_to_utf16(name, NULL); + if (p == NULL) + return -1; + retval = _wrmdir(p); + vim_free(p); + return retval; + } +#endif + return _rmdir(name); +} + /* * Return TRUE if file "fname" has more than one link. */ diff --git a/src/proto/os_win32.pro b/src/proto/os_win32.pro index e6fce88a3b..7cdd15677a 100644 --- a/src/proto/os_win32.pro +++ b/src/proto/os_win32.pro @@ -22,6 +22,7 @@ void mch_hide __ARGS((char_u *name)); int mch_ishidden __ARGS((char_u *name)); int mch_isdir __ARGS((char_u *name)); int mch_mkdir __ARGS((char_u *name)); +int mch_rmdir __ARGS((char_u *name)); int mch_is_hard_link __ARGS((char_u *fname)); int mch_is_symbolic_link __ARGS((char_u *fname)); int mch_is_linked __ARGS((char_u *fname)); diff --git a/src/version.c b/src/version.c index 1a61df43a0..2767f1d820 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1109, /**/ 1108, /**/ From 8c600052fabe4859470d9d0ba2ddd74a52ea9745 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 22:08:11 +0100 Subject: [PATCH 04/16] patch 7.4.1110 Problem: Test 108 fails when language is French. Solution: Force English messages. (Dominique Pelle) --- src/testdir/test108.in | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/testdir/test108.in b/src/testdir/test108.in index b442cf7fcf..59c4dfc712 100644 --- a/src/testdir/test108.in +++ b/src/testdir/test108.in @@ -2,6 +2,7 @@ Tests for backtrace debug commands. vim: set ft=vim : STARTTEST :so small.vim +:lang mess C :function! Foo() : let var1 = 1 : let var2 = Bar(var1) + 9 diff --git a/src/version.c b/src/version.c index 2767f1d820..a5831bfa9b 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1110, /**/ 1109, /**/ From f60b796fa9870bdfc4cdeb91653bac041916077d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 22:47:23 +0100 Subject: [PATCH 05/16] patch 7.4.1111 Problem: test_expand fails on MS-Windows. Solution: Always use forward slashes. Remove references to test27. --- src/testdir/Make_all.mak | 1 - src/testdir/Make_amiga.mak | 1 - src/testdir/Make_dos.mak | 1 - src/testdir/Make_ming.mak | 1 - src/testdir/runtest.vim | 3 +++ src/testdir/test_expand.vim | 6 ++++-- src/version.c | 2 ++ 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 33fc3451b7..81e196c1df 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -139,7 +139,6 @@ SCRIPTS_MORE2 = \ test10.out \ test12.out \ test25.out \ - test27.out \ test49.out \ test97.out diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index c39e450d5c..cea4699cad 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -15,7 +15,6 @@ include Make_all.mak # test11 "cat" doesn't work properly # test12 can't unlink a swap file # test25 uses symbolic link -# test27 can't edit file with "*" # test52 only for Win32 # test85 no Lua interface # test86, 87 no Python interface diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index f6e45d83eb..47f9d22230 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -14,7 +14,6 @@ default: nongui # test10 'errorformat' is different # test12 can't unlink a swap file # test25 uses symbolic link -# test27 can't edit file with "*" in file name # test49 fails in various ways # test97 \{ and \$ are not escaped characters. diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 88e72b15e2..b4ebaebe91 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -35,7 +35,6 @@ include Make_all.mak # test10 'errorformat' is different # test12 can't unlink a swap file # test25 uses symbolic link -# test27 can't edit file with "*" in file name # test54 doesn't work yet # test97 \{ and \$ are not escaped characters diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index fd64c98fc3..2a9231abcc 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -43,6 +43,9 @@ set nomore " Output all messages in English. lang mess C +" Always use forward slashes. +set shellslash + let s:srcdir = expand('%:p:h:h') " Support function: get the alloc ID by name. diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim index fd999db1b7..a68c4226f0 100644 --- a/src/testdir/test_expand.vim +++ b/src/testdir/test_expand.vim @@ -16,8 +16,10 @@ func Test_with_directories() next Xdir?/*/file call assert_equal('Xdir3/Xdir4/file', expand('%')) - next! Xdir?/*/nofile - call assert_equal('Xdir?/*/nofile', expand('%')) + if has('unix') + next! Xdir?/*/nofile + call assert_equal('Xdir?/*/nofile', expand('%')) + endif call delete('Xdir1', 'rf') call delete('Xdir2', 'rf') diff --git a/src/version.c b/src/version.c index a5831bfa9b..ac54f8496b 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1111, /**/ 1110, /**/ From 2db5c3b3ceeaded7fb5a64dc5cb22b0cb95b78a1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 22:49:34 +0100 Subject: [PATCH 06/16] patch 7.4.1112 Problem: When using ":next" with an illegal file name no error is reported. Solution: Give an error message. --- src/ex_cmds2.c | 4 +--- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 676cf117b4..5b113668d1 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2147,9 +2147,7 @@ do_arglist(str, what, after) i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data, &exp_count, &exp_files, EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND); ga_clear(&new_ga); - if (i == FAIL) - return FAIL; - if (exp_count == 0) + if (i == FAIL || exp_count == 0) { EMSG(_(e_nomatch)); return FAIL; diff --git a/src/version.c b/src/version.c index ac54f8496b..4cce40b911 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1112, /**/ 1111, /**/ From 4119cf80e1e534057680f9543e73edf7967c2440 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 14:59:01 +0100 Subject: [PATCH 07/16] patch 7.4.1113 Problem: Using {ns} in variable name does not work. (lilydjwg) Solution: Fix recognizing colon. Add a test. --- src/eval.c | 4 ++-- src/testdir/test_viml.vim | 16 +++++++++++++++- src/version.c | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/eval.c b/src/eval.c index c61b64dd60..fb2cbe79e5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -20844,10 +20844,10 @@ find_name_end(arg, expr_start, expr_end, flags) else if (br_nest == 0 && mb_nest == 0 && *p == ':') { /* "s:" is start of "s:var", but "n:" is not and can be used in - * slice "[n:]". Also "xx:" is not a namespace. */ + * slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. */ len = (int)(p - arg); if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL) - || len > 1) + || (len > 1 && p[-1] != '}')) break; } diff --git a/src/testdir/test_viml.vim b/src/testdir/test_viml.vim index 5d65953a9e..07286fb024 100644 --- a/src/testdir/test_viml.vim +++ b/src/testdir/test_viml.vim @@ -1,5 +1,5 @@ " Test various aspects of the Vim language. -" This was formerly in test49. +" Most of this was formerly in test49. "------------------------------------------------------------------------------- " Test environment {{{1 @@ -906,6 +906,20 @@ func Test_if_bar_fail() call assert_equal('acdfh-acfh', g:test15_result) endfunc +"------------------------------------------------------------------------------- +" Test 90: Recognizing {} in variable name. {{{1 +"------------------------------------------------------------------------------- + +func Test_curlies() + let s:var = 66 + let ns = 's' + call assert_equal(66, {ns}:var) + + let g:a = {} + let g:b = 't' + let g:a[g:b] = 77 + call assert_equal(77, g:a['t']) +endfunc "------------------------------------------------------------------------------- " Modelines {{{1 diff --git a/src/version.c b/src/version.c index 4cce40b911..8d9fda8153 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1113, /**/ 1112, /**/ From 43a34f9f74fdce462fa250baab620264c28b6165 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 15:56:34 +0100 Subject: [PATCH 08/16] patch 7.4.1114 Problem: delete() does not work well with symbolic links. Solution: Recognize symbolik links. --- runtime/doc/eval.txt | 7 +++-- src/eval.c | 2 +- src/fileio.c | 14 ++++++++- src/os_unix.c | 24 ++++++++++++++- src/proto/os_unix.pro | 1 + src/testdir/test_delete.vim | 61 +++++++++++++++++++++++++++++++++++++ src/version.c | 2 ++ 7 files changed, 105 insertions(+), 6 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 6edd3f5411..fb6a851447 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2755,13 +2755,14 @@ deepcopy({expr}[, {noref}]) *deepcopy()* *E698* delete({fname} [, {flags}]) *delete()* Without {flags} or with {flags} empty: Deletes the file by the - name {fname}. + name {fname}. This also works when {fname} is a symbolic link. When {flags} is "d": Deletes the directory by the name - {fname}. This fails when {fname} is not empty. + {fname}. This fails when directory {fname} is not empty. When {flags} is "rf": Deletes the directory by the name - {fname} and everything in it, recursively. Be careful! + {fname} and everything in it, recursively. BE CAREFUL! + A symbolic link itself is deleted, not what it points to. The result is a Number, which is 0 if the delete operation was successful and -1 when the deletion failed or partly failed. diff --git a/src/eval.c b/src/eval.c index fb2cbe79e5..aec1ea9873 100644 --- a/src/eval.c +++ b/src/eval.c @@ -10418,7 +10418,7 @@ f_delete(argvars, rettv) /* delete an empty directory */ rettv->vval.v_number = mch_rmdir(name) == 0 ? 0 : -1; else if (STRCMP(flags, "rf") == 0) - /* delete an directory recursively */ + /* delete a directory recursively */ rettv->vval.v_number = delete_recursive(name); else EMSG2(_(e_invexpr2), flags); diff --git a/src/fileio.c b/src/fileio.c index 6dbdea21e6..f809eb5bc3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7294,7 +7294,19 @@ delete_recursive(char_u *name) int i; char_u *exp; - if (mch_isdir(name)) + /* A symbolic link to a directory itself is deleted, not the directory it + * points to. */ + if ( +# if defined(WIN32) + mch_isdir(name) && !mch_is_symbolic_link(name) +# else +# ifdef UNIX + mch_isrealdir(name) +# else + mch_isdir(name) +# endif +# endif + ) { vim_snprintf((char *)NameBuff, MAXPATHL, "%s/*", name); exp = vim_strsave(NameBuff); diff --git a/src/os_unix.c b/src/os_unix.c index 36196369cb..d2e1c79bd9 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -2994,7 +2994,7 @@ mch_hide(name) } /* - * return TRUE if "name" is a directory + * return TRUE if "name" is a directory or a symlink to a directory * return FALSE if "name" is not a directory * return FALSE for error */ @@ -3015,6 +3015,28 @@ mch_isdir(name) #endif } +/* + * return TRUE if "name" is a directory, NOT a symlink to a directory + * return FALSE if "name" is not a directory + * return FALSE for error + */ + int +mch_isrealdir(name) + char_u *name; +{ + struct stat statb; + + if (*name == NUL) /* Some stat()s don't flag "" as an error. */ + return FALSE; + if (lstat((char *)name, &statb)) + return FALSE; +#ifdef _POSIX_SOURCE + return (S_ISDIR(statb.st_mode) ? TRUE : FALSE); +#else + return ((statb.st_mode & S_IFMT) == S_IFDIR ? TRUE : FALSE); +#endif +} + static int executable_file __ARGS((char_u *name)); /* diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro index 89dff7791d..be6eb6f103 100644 --- a/src/proto/os_unix.pro +++ b/src/proto/os_unix.pro @@ -41,6 +41,7 @@ void mch_set_acl __ARGS((char_u *fname, vim_acl_T aclent)); void mch_free_acl __ARGS((vim_acl_T aclent)); void mch_hide __ARGS((char_u *name)); int mch_isdir __ARGS((char_u *name)); +int mch_isrealdir __ARGS((char_u *name)); int mch_can_exe __ARGS((char_u *name, char_u **path, int use_path)); int mch_nodetype __ARGS((char_u *name)); void mch_early_init __ARGS((void)); diff --git a/src/testdir/test_delete.vim b/src/testdir/test_delete.vim index 6e2b9c86bb..13c87a152f 100644 --- a/src/testdir/test_delete.vim +++ b/src/testdir/test_delete.vim @@ -34,3 +34,64 @@ func Test_recursive_delete() call assert_false(isdirectory('Xdir1')) call assert_equal(-1, delete('Xdir1', 'd')) endfunc + +func Test_symlink_delete() + if !has('unix') + return + endif + split Xfile + call setline(1, ['a', 'b']) + wq + silent !ln -s Xfile Xlink + " Delete the link, not the file + call assert_equal(0, delete('Xlink')) + call assert_equal(-1, delete('Xlink')) + call assert_equal(0, delete('Xfile')) +endfunc + +func Test_symlink_dir_delete() + if !has('unix') + return + endif + call mkdir('Xdir1') + silent !ln -s Xdir1 Xlink + call assert_true(isdirectory('Xdir1')) + call assert_true(isdirectory('Xlink')) + " Delete the link, not the directory + call assert_equal(0, delete('Xlink')) + call assert_equal(-1, delete('Xlink')) + call assert_equal(0, delete('Xdir1', 'd')) +endfunc + +func Test_symlink_recursive_delete() + if !has('unix') + return + endif + call mkdir('Xdir3') + call mkdir('Xdir3/subdir') + call mkdir('Xdir4') + split Xdir3/Xfile + call setline(1, ['a', 'b']) + w + w Xdir3/subdir/Xfile + w Xdir4/Xfile + close + silent !ln -s ../Xdir4 Xdir3/Xlink + + call assert_true(isdirectory('Xdir3')) + call assert_equal(['a', 'b'], readfile('Xdir3/Xfile')) + call assert_true(isdirectory('Xdir3/subdir')) + call assert_equal(['a', 'b'], readfile('Xdir3/subdir/Xfile')) + call assert_true(isdirectory('Xdir4')) + call assert_true(isdirectory('Xdir3/Xlink')) + call assert_equal(['a', 'b'], readfile('Xdir4/Xfile')) + + call assert_equal(0, delete('Xdir3', 'rf')) + call assert_false(isdirectory('Xdir3')) + call assert_equal(-1, delete('Xdir3', 'd')) + " symlink is deleted, not the directory it points to + call assert_true(isdirectory('Xdir4')) + call assert_equal(['a', 'b'], readfile('Xdir4/Xfile')) + call assert_equal(0, delete('Xdir4/Xfile')) + call assert_equal(0, delete('Xdir4', 'd')) +endfunc diff --git a/src/version.c b/src/version.c index 8d9fda8153..571cb682cf 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1114, /**/ 1113, /**/ From d0232917ced39ff4838665fbcf379d5116a91aa3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 16:15:32 +0100 Subject: [PATCH 09/16] patch 7.4.1115 Problem: MS-Windows: make clean in testdir doesn't clean everything. Solution: Add command to delete X* directories. (Ken Takata) --- src/testdir/Make_dos.mak | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 47f9d22230..480993087a 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -89,6 +89,7 @@ clean: -if exist Xdir1 rd /s /q Xdir1 -if exist Xfind rd /s /q Xfind -del X* + -for /d %i in (X*) do @rmdir /s/q %i -if exist viminfo del viminfo -if exist test.log del test.log -if exist messages del messages diff --git a/src/version.c b/src/version.c index 571cb682cf..4e23c61614 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1115, /**/ 1114, /**/ From b0967d587fc420fa02832533d4915c85d1a78c17 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 16:49:43 +0100 Subject: [PATCH 10/16] patch 7.4.1116 Problem: delete(x, 'rf') does not delete files starting with a dot. Solution: Also delete files starting with a dot. --- src/fileio.c | 2 +- src/misc1.c | 11 +++++++---- src/version.c | 2 ++ src/vim.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index f809eb5bc3..fdaad20bbc 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7313,7 +7313,7 @@ delete_recursive(char_u *name) if (exp == NULL) return -1; if (gen_expand_wildcards(1, &exp, &file_count, &files, - EW_DIR|EW_FILE|EW_SILENT) == OK) + EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT) == OK) { for (i = 0; i < file_count; ++i) if (delete_recursive(files[i]) != 0) diff --git a/src/misc1.c b/src/misc1.c index 4f36fd80d1..66569d4a09 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -10013,7 +10013,7 @@ dos_expandpath( if (p[0] == '*' && p[1] == '*') starstar = TRUE; - starts_with_dot = (*s == '.'); + starts_with_dot = *s == '.' || (flags & EW_DODOT); pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { @@ -10096,7 +10096,8 @@ dos_expandpath( #endif /* Ignore entries starting with a dot, unless when asked for. Accept * all entries found with "matchname". */ - if ((p[0] != '.' || starts_with_dot) + if ((p[0] != '.' || (starts_with_dot + && p[1] != NUL && (p[1] != '.' || p[2] != NUL))) && (matchname == NULL || (regmatch.regprog != NULL && vim_regexec(®match, p, (colnr_T)0)) @@ -10325,7 +10326,7 @@ unix_expandpath(gap, path, wildoff, flags, didstar) starstar = TRUE; /* convert the file pattern to a regexp pattern */ - starts_with_dot = (*s == '.'); + starts_with_dot = *s == '.' || (flags & EW_DODOT); pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { @@ -10374,7 +10375,9 @@ unix_expandpath(gap, path, wildoff, flags, didstar) dp = readdir(dirp); if (dp == NULL) break; - if ((dp->d_name[0] != '.' || starts_with_dot) + if ((dp->d_name[0] != '.' || (starts_with_dot + && dp->d_name[1] != NUL + && (dp->d_name[1] != '.' || dp->d_name[2] != NUL))) && ((regmatch.regprog != NULL && vim_regexec(®match, (char_u *)dp->d_name, (colnr_T)0)) || ((flags & EW_NOTWILD) diff --git a/src/version.c b/src/version.c index 4e23c61614..50a6827194 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1116, /**/ 1115, /**/ diff --git a/src/vim.h b/src/vim.h index a8a6eadfef..a39c6fda5e 100644 --- a/src/vim.h +++ b/src/vim.h @@ -835,6 +835,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EW_ALLLINKS 0x1000 /* also links not pointing to existing file */ #define EW_SHELLCMD 0x2000 /* called from expand_shellcmd(), don't check * if executable is in $PATH */ +#define EW_DODOT 0x4000 /* also files starting with a dot */ /* Flags for find_file_*() functions. */ #define FINDFILE_FILE 0 /* only files */ From d82103ed8534a1207742e9666ac7ef1e47dda12d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 17:04:05 +0100 Subject: [PATCH 11/16] patch 7.4.1117 Problem: No longer get "." and ".." in directory list. Solution: Do not skip "." and ".." unless EW_DODOT is set. --- src/misc1.c | 16 +++++++++------- src/version.c | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/misc1.c b/src/misc1.c index 66569d4a09..fd63ec37f6 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -10013,7 +10013,7 @@ dos_expandpath( if (p[0] == '*' && p[1] == '*') starstar = TRUE; - starts_with_dot = *s == '.' || (flags & EW_DODOT); + starts_with_dot = *s == '.'; pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { @@ -10096,8 +10096,9 @@ dos_expandpath( #endif /* Ignore entries starting with a dot, unless when asked for. Accept * all entries found with "matchname". */ - if ((p[0] != '.' || (starts_with_dot - && p[1] != NUL && (p[1] != '.' || p[2] != NUL))) + if ((p[0] != '.' || starts_with_dot + || ((flags & EW_DODOT) + && p[1] != NUL && (p[1] != '.' || p[2] != NUL))) && (matchname == NULL || (regmatch.regprog != NULL && vim_regexec(®match, p, (colnr_T)0)) @@ -10326,7 +10327,7 @@ unix_expandpath(gap, path, wildoff, flags, didstar) starstar = TRUE; /* convert the file pattern to a regexp pattern */ - starts_with_dot = *s == '.' || (flags & EW_DODOT); + starts_with_dot = *s == '.'; pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { @@ -10375,9 +10376,10 @@ unix_expandpath(gap, path, wildoff, flags, didstar) dp = readdir(dirp); if (dp == NULL) break; - if ((dp->d_name[0] != '.' || (starts_with_dot - && dp->d_name[1] != NUL - && (dp->d_name[1] != '.' || dp->d_name[2] != NUL))) + if ((dp->d_name[0] != '.' || starts_with_dot + || ((flags & EW_DODOT) + && dp->d_name[1] != NUL + && (dp->d_name[1] != '.' || dp->d_name[2] != NUL))) && ((regmatch.regprog != NULL && vim_regexec(®match, (char_u *)dp->d_name, (colnr_T)0)) || ((flags & EW_NOTWILD) diff --git a/src/version.c b/src/version.c index 50a6827194..ee4ec0e016 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1117, /**/ 1116, /**/ From a99b90437af730dcafd9143c0942c87777a00d52 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 17:10:59 +0100 Subject: [PATCH 12/16] patch 7.4.1118 Problem: Tests hang in 24 line terminal. Solution: Set the 'more' option off. --- src/testdir/runtest.vim | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 2a9231abcc..686a4df625 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -84,6 +84,7 @@ else endif " Locate Test_ functions and execute them. +set nomore redir @q function /^Test_ redir END diff --git a/src/version.c b/src/version.c index ee4ec0e016..26cd06e8d1 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1118, /**/ 1117, /**/ From 72defda84eb26be9e2ade56c7877b912f818026e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 18:04:33 +0100 Subject: [PATCH 13/16] patch 7.4.1119 Problem: argidx() has a wrong value after ":%argdelete". (Yegappan Lakshmanan) Solution: Correct the value of w_arg_idx. Add a test. --- src/ex_cmds2.c | 4 ++++ src/testdir/Make_all.mak | 3 ++- src/testdir/test_arglist.vim | 22 ++++++++++++++++++++++ src/version.c | 2 ++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/testdir/test_arglist.vim diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 5b113668d1..012a1af222 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2562,6 +2562,10 @@ ex_argdelete(eap) curwin->w_arg_idx -= n; else if (curwin->w_arg_idx > eap->line1) curwin->w_arg_idx = eap->line1; + if (ARGCOUNT == 0) + curwin->w_arg_idx = 0; + else if (curwin->w_arg_idx >= ARGCOUNT) + curwin->w_arg_idx = ARGCOUNT - 1; } } else if (*eap->arg == NUL) diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 81e196c1df..69fd936cd1 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -171,7 +171,8 @@ SCRIPTS_GUI = test16.out # Tests using runtest.vim.vim. # Keep test_alot.res as the last one, sort the others. -NEW_TESTS = test_assert.res \ +NEW_TESTS = test_arglist.res \ + test_assert.res \ test_cdo.res \ test_hardcopy.res \ test_increment.res \ diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim new file mode 100644 index 0000000000..3f72f0ff9c --- /dev/null +++ b/src/testdir/test_arglist.vim @@ -0,0 +1,22 @@ +" Test argument list commands + +func Test_argidx() + args a b c + last + call assert_equal(2, argidx()) + %argdelete + call assert_equal(0, argidx()) + + args a b c + call assert_equal(0, argidx()) + next + call assert_equal(1, argidx()) + next + call assert_equal(2, argidx()) + 1argdelete + call assert_equal(1, argidx()) + 1argdelete + call assert_equal(0, argidx()) + 1argdelete + call assert_equal(0, argidx()) +endfunc diff --git a/src/version.c b/src/version.c index 26cd06e8d1..f26828c85c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1119, /**/ 1118, /**/ From 336bd622c31e1805495c034e1a8cfadcc0bbabc7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 18:23:58 +0100 Subject: [PATCH 14/16] patch 7.4.1120 Problem: delete(x, 'rf') fails if a directory is empty. (Lcd) Solution: Ignore not finding matches in an empty directory. --- src/fileio.c | 2 +- src/misc1.c | 2 +- src/testdir/test_delete.vim | 2 ++ src/version.c | 2 ++ src/vim.h | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index fdaad20bbc..55337d6825 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7313,7 +7313,7 @@ delete_recursive(char_u *name) if (exp == NULL) return -1; if (gen_expand_wildcards(1, &exp, &file_count, &files, - EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT) == OK) + EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT|EW_EMPTYOK) == OK) { for (i = 0; i < file_count; ++i) if (delete_recursive(files[i]) != 0) diff --git a/src/misc1.c b/src/misc1.c index fd63ec37f6..a44e4d6819 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -11087,7 +11087,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) recursive = FALSE; - return (ga.ga_data != NULL) ? retval : FAIL; + return ((flags & EW_EMPTYOK) || ga.ga_data != NULL) ? retval : FAIL; } # ifdef VIM_BACKTICK diff --git a/src/testdir/test_delete.vim b/src/testdir/test_delete.vim index 13c87a152f..3cf26234dc 100644 --- a/src/testdir/test_delete.vim +++ b/src/testdir/test_delete.vim @@ -21,6 +21,7 @@ endfunc func Test_recursive_delete() call mkdir('Xdir1') call mkdir('Xdir1/subdir') + call mkdir('Xdir1/empty') split Xdir1/Xfile call setline(1, ['a', 'b']) w @@ -30,6 +31,7 @@ func Test_recursive_delete() call assert_equal(['a', 'b'], readfile('Xdir1/Xfile')) call assert_true(isdirectory('Xdir1/subdir')) call assert_equal(['a', 'b'], readfile('Xdir1/subdir/Xfile')) + call assert_true(isdirectory('Xdir1/empty')) call assert_equal(0, delete('Xdir1', 'rf')) call assert_false(isdirectory('Xdir1')) call assert_equal(-1, delete('Xdir1', 'd')) diff --git a/src/version.c b/src/version.c index f26828c85c..ef98ee4b8a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1120, /**/ 1119, /**/ diff --git a/src/vim.h b/src/vim.h index a39c6fda5e..7180d2372c 100644 --- a/src/vim.h +++ b/src/vim.h @@ -836,6 +836,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EW_SHELLCMD 0x2000 /* called from expand_shellcmd(), don't check * if executable is in $PATH */ #define EW_DODOT 0x4000 /* also files starting with a dot */ +#define EW_EMPTYOK 0x8000 /* no matches is not an error */ /* Flags for find_file_*() functions. */ #define FINDFILE_FILE 0 /* only files */ From 08b270a8a4544be9a7fecce311834fde2b457634 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 18:34:19 +0100 Subject: [PATCH 15/16] patch 7.4.1121 Problem: test_expand leaves files behind. Solution: Edit another file before deleting, otherwise the swap file remains. --- src/testdir/test_expand.vim | 9 ++++++--- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim index a68c4226f0..c099edae1c 100644 --- a/src/testdir/test_expand.vim +++ b/src/testdir/test_expand.vim @@ -20,10 +20,13 @@ func Test_with_directories() next! Xdir?/*/nofile call assert_equal('Xdir?/*/nofile', expand('%')) endif + " Edit another file, on MS-Windows the swap file would be in use and can't + " be deleted. + edit foo - call delete('Xdir1', 'rf') - call delete('Xdir2', 'rf') - call delete('Xdir3', 'rf') + call assert_equal(0, delete('Xdir1', 'rf')) + call assert_equal(0, delete('Xdir2', 'rf')) + call assert_equal(0, delete('Xdir3', 'rf')) endfunc func Test_with_tilde() diff --git a/src/version.c b/src/version.c index ef98ee4b8a..06044d4701 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1121, /**/ 1120, /**/ From 42c9cfa7f4d2f176234e385573ff2fb1f61915e5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Jan 2016 18:49:57 +0100 Subject: [PATCH 16/16] patch 7.4.1122 Problem: Test 92 and 93 fail when using gvim on a system with a non utf-8 locale. Solution: Avoid using .gvimrc by adding -U NONE. (Yukihiro Nakadaira) --- src/testdir/Make_dos.mak | 6 +++--- src/testdir/Make_ming.mak | 4 ++-- src/testdir/Make_vms.mms | 2 +- src/testdir/Makefile | 2 +- src/version.c | 2 ++ 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 480993087a..3073e9eb5c 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -38,7 +38,7 @@ win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report $(DOSTMP_INFILES): $(*B).in if not exist $(DOSTMP)\NUL md $(DOSTMP) if exist $@ del $@ - $(VIMPROG) -u dos.vim --noplugin "+set ff=dos|f $@|wq" $(*B).in + $(VIMPROG) -u dos.vim -U NONE --noplugin "+set ff=dos|f $@|wq" $(*B).in # For each input file dostmp/test99.in run the tests. # This moves test99.in to test99.in.bak temporarily. @@ -55,7 +55,7 @@ $(TEST_OUTFILES): $(DOSTMP)\$(*B).in -@if exist Xfind rd /s /q Xfind -@del X* -@if exist viminfo del viminfo - $(VIMPROG) -u dos.vim --noplugin "+set ff=unix|f test.out|wq" \ + $(VIMPROG) -u dos.vim -U NONE --noplugin "+set ff=unix|f test.out|wq" \ $(DOSTMP)\$(*B).out @diff test.out $*.ok & if errorlevel 1 \ ( move /y test.out $*.failed \ @@ -114,4 +114,4 @@ bench_re_freeze.out: bench_re_freeze.vim newtests: $(NEW_TESTS) .vim.res: - $(VIMPROG) -u NONE -S runtest.vim $*.vim + $(VIMPROG) -u NONE -U NONE -S runtest.vim $*.vim diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index b4ebaebe91..d0b088c609 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -65,8 +65,8 @@ win32: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) echo ALL DONE fixff: - -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok - -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \ + -$(VIMPROG) -u dos.vim -U NONE --noplugin "+argdo set ff=dos|upd" +q *.in *.ok + -$(VIMPROG) -u dos.vim -U NONE --noplugin "+argdo set ff=unix|upd" +q \ dotest.in test60.ok test71.ok test74.ok test_listchars.ok clean: diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 9a93e21a75..17b7429943 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -163,7 +163,7 @@ SCRIPT_PYTHON = test86.out test87.out -@ write sys$output " "$*" " -@ write sys$output "-----------------------------------------------" -@ !run the test - -@ create/term/wait/nodetach mcr $(VIMPROG) $(GUI_OPTION) -u vms.vim --noplugin -s dotest.in $*.in + -@ create/term/wait/nodetach mcr $(VIMPROG) $(GUI_OPTION) -u vms.vim -U NONE --noplugin -s dotest.in $*.in -@ !analyse the result -@ directory /size/date test.out -@ if "''F$SEARCH("test.out.*")'" .NES. "" then rename/nolog test.out $*.out diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 8f321b5852..6d98a80a34 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -127,4 +127,4 @@ newtestssilent: $(NEW_TESTS) .vim.res: - $(RUN_VIMTEST) -u NONE -S runtest.vim $*.vim + $(RUN_VIMTEST) -u NONE -U NONE -S runtest.vim $*.vim diff --git a/src/version.c b/src/version.c index 06044d4701..76e176a888 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1122, /**/ 1121, /**/