Bram,

here is a patch, that makes undofile() return an empty string, if given 
an empty string. Consider this:
vim -u NONE -U NONE -N -c ':set undofile|echo undofile(@%)'
this returns something like this:
/home/.chrisbra.un~
(/home/chrisbra is my $HOME), even though I think, when giving an empty 
string as argument undofile() should return an empty string.

So this is what the following patch does. I refrained from patching 
FullName_save() because I don't know if this function should return 
NULL, if given an empty argument, so I only make f_undofile() check for 
the empty string.

diff --git a/src/eval.c b/src/eval.c
--- a/src/eval.c
+++ b/src/eval.c
@@ -18259,11 +18259,18 @@
     rettv->v_type = VAR_STRING;
 #ifdef FEAT_PERSISTENT_UNDO
     {
-       char_u *ffname = FullName_save(get_tv_string(&argvars[0]), FALSE);
-
-       if (ffname != NULL)
-           rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
-       vim_free(ffname);
+       char_u *ffname = get_tv_string(&argvars[0]);
+
+       if (*ffname == NUL)
+         rettv->vval.v_string = NULL;
+       else
+       {
+           ffname = FullName_save(ffname, FALSE);
+
+           if (ffname != NULL)
+               rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
+           vim_free(ffname);
+       }
     }
 #else
     rettv->vval.v_string = NULL;

regards,
Christian

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui