diff options
author | Bram Moolenaar <Bram@vim.org> | 2012-04-30 17:35:48 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2012-04-30 17:35:48 +0200 |
commit | b41d9689f1bec8434bb400b344b249180ac47668 (patch) | |
tree | 35aa6b0fefdd1ab72da58dcea347da3fe415cda6 | |
parent | 7da9c37a17745e0021e59467e55ee11976752603 (diff) | |
download | vim-b41d9689f1bec8434bb400b344b249180ac47668.zip |
updated for version 7.3.512
Problem: undofile() returns a useless name when passed an empty string.
Solution: Return an empty string. (Christian Brabandt)
-rw-r--r-- | src/eval.c | 18 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c index 4d45ae257..fa9966e7e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -18259,11 +18259,21 @@ f_undofile(argvars, rettv) rettv->v_type = VAR_STRING; #ifdef FEAT_PERSISTENT_UNDO { - char_u *ffname = FullName_save(get_tv_string(&argvars[0]), FALSE); + char_u *fname = get_tv_string(&argvars[0]); - if (ffname != NULL) - rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE); - vim_free(ffname); + if (*fname == NUL) + { + /* If there is no file name there will be no undo file. */ + rettv->vval.v_string = NULL; + } + else + { + char_u *ffname = FullName_save(fname, FALSE); + + if (ffname != NULL) + rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE); + vim_free(ffname); + } } #else rettv->vval.v_string = NULL; diff --git a/src/version.c b/src/version.c index b2f9a986b..ce22d9f99 100644 --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 512, +/**/ 511, /**/ 510, |