mirror of
https://github.com/vim/vim.git
synced 2025-10-13 06:54:15 -04:00
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 #7021)
This commit is contained in:
@@ -2436,6 +2436,12 @@ f_expand(typval_T *argvars, typval_T *rettv)
|
|||||||
expand_T xpc;
|
expand_T xpc;
|
||||||
int error = FALSE;
|
int error = FALSE;
|
||||||
char_u *result;
|
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;
|
rettv->v_type = VAR_STRING;
|
||||||
if (argvars[1].v_type != VAR_UNKNOWN
|
if (argvars[1].v_type != VAR_UNKNOWN
|
||||||
@@ -2488,6 +2494,9 @@ f_expand(typval_T *argvars, typval_T *rettv)
|
|||||||
else
|
else
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
|
p_csl = p_csl_save;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -363,12 +363,12 @@ endfunc
|
|||||||
" Test for insert path completion with completeslash option
|
" Test for insert path completion with completeslash option
|
||||||
func Test_ins_completeslash()
|
func Test_ins_completeslash()
|
||||||
CheckMSWindows
|
CheckMSWindows
|
||||||
|
|
||||||
call mkdir('Xdir')
|
call mkdir('Xdir')
|
||||||
let orig_shellslash = &shellslash
|
let orig_shellslash = &shellslash
|
||||||
set cpt&
|
set cpt&
|
||||||
new
|
new
|
||||||
|
|
||||||
set noshellslash
|
set noshellslash
|
||||||
|
|
||||||
set completeslash=
|
set completeslash=
|
||||||
@@ -654,4 +654,17 @@ func Test_complete_cmdline()
|
|||||||
close!
|
close!
|
||||||
endfunc
|
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
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1747,
|
||||||
/**/
|
/**/
|
||||||
1746,
|
1746,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user