vim-patch:8.1.1352: undofile() reports wrong name

Problem:    Undofile() reports wrong name. (Francisco Giordano)
Solution:   Clean up the name before changing path separators. (closes vim/vim#4392,
            closes vim/vim#4394)
e9ebc9a91c
This commit is contained in:
Francisco Giordano
2019-05-19 15:25:18 -03:00
parent 8e941c59ec
commit 8b3c0b87ff
2 changed files with 6 additions and 1 deletions

View File

@@ -17669,7 +17669,7 @@ static void f_undofile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// If there is no file name there will be no undo file. // If there is no file name there will be no undo file.
rettv->vval.v_string = NULL; rettv->vval.v_string = NULL;
} else { } else {
char *ffname = FullName_save(fname, false); char *ffname = FullName_save(fname, true);
if (ffname != NULL) { if (ffname != NULL) {
rettv->vval.v_string = (char_u *)u_get_undo_file_name(ffname, false); rettv->vval.v_string = (char_u *)u_get_undo_file_name(ffname, false);

View File

@@ -389,6 +389,11 @@ funct Test_undofile()
" Test undofile() with 'undodir' set to a non-existing directory. " Test undofile() with 'undodir' set to a non-existing directory.
" call assert_equal('', undofile('Xundofoo')) " call assert_equal('', undofile('Xundofoo'))
if isdirectory('/tmp')
set undodir=/tmp
call assert_equal('/tmp/%tmp%file', undofile('///tmp/file'))
endif
set undodir& set undodir&
endfunc endfunc