Skip to content

Commit 6cc7a15

Browse files
committed
updated for version 7.3.512
Problem: undofile() returns a useless name when passed an empty string. Solution: Return an empty string. (Christian Brabandt)
1 parent 01e7017 commit 6cc7a15

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/eval.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18259,11 +18259,21 @@ f_undofile(argvars, rettv)
1825918259
rettv->v_type = VAR_STRING;
1826018260
#ifdef FEAT_PERSISTENT_UNDO
1826118261
{
18262-
char_u *ffname = FullName_save(get_tv_string(&argvars[0]), FALSE);
18262+
char_u *fname = get_tv_string(&argvars[0]);
1826318263

18264-
if (ffname != NULL)
18265-
rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
18266-
vim_free(ffname);
18264+
if (*fname == NUL)
18265+
{
18266+
/* If there is no file name there will be no undo file. */
18267+
rettv->vval.v_string = NULL;
18268+
}
18269+
else
18270+
{
18271+
char_u *ffname = FullName_save(fname, FALSE);
18272+
18273+
if (ffname != NULL)
18274+
rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
18275+
vim_free(ffname);
18276+
}
1826718277
}
1826818278
#else
1826918279
rettv->vval.v_string = NULL;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ static char *(features[]) =
714714

715715
static int included_patches[] =
716716
{ /* Add new patch number below this line */
717+
/**/
718+
512,
717719
/**/
718720
511,
719721
/**/

0 commit comments

Comments
 (0)