vim-patch:8.2.1747: result of expand() unexpectedly depends on 'completeslash'

Problem:    Result of expand() unexpectedly depends on 'completeslash'.
Solution:   Temporarily reset 'completeslash'. (Yasuhiro Matsumoto,
            closes vim/vim#7021)
8f187fc630
This commit is contained in:
skippi 2020-10-19 20:55:27 -05:00
parent f8fd3d44ac
commit 6a0cb2a948
2 changed files with 22 additions and 0 deletions

View File

@ -2071,6 +2071,12 @@ static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
expand_T xpc;
bool error = false;
char_u *result;
#ifdef BACKSLASH_IN_FILENAME
char_u *p_csl_save = p_csl;
// avoid using 'completeslash' here
p_csl = empty_option;
#endif
rettv->v_type = VAR_STRING;
if (argvars[1].v_type != VAR_UNKNOWN
@ -2123,6 +2129,9 @@ static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_string = NULL;
}
}
#ifdef BACKSLASH_IN_FILENAME
p_csl = p_csl_save;
#endif
}

View File

@ -414,6 +414,19 @@ func Test_ins_completeslash()
set completeslash=
endfunc
func Test_issue_7021()
CheckMSWindows
let orig_shellslash = &shellslash
set noshellslash
set completeslash=slash
call assert_false(expand('~') =~ '/')
let &shellslash = orig_shellslash
set completeslash=
endfunc
func Test_pum_with_folds_two_tabs()
CheckScreendump