mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 7.4.1108
Problem: Expanding "~" halfway a file name. Solution: Handle the file name as one name. (Marco Hinz) Add a test. Closes #564.
This commit is contained in:
@@ -1975,12 +1975,15 @@ test1 \
|
|||||||
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
|
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
|
||||||
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
|
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
|
||||||
test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
|
test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
|
||||||
test100 test101 test102 test103 test104 test105 test106 test107:
|
test100 test101 test102 test103 test104 test105 test106 test107 test108:
|
||||||
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
||||||
|
|
||||||
test_assert \
|
test_assert \
|
||||||
test_backspace_opt \
|
test_backspace_opt \
|
||||||
test_cdo \
|
test_cdo \
|
||||||
|
test_cursor_func \
|
||||||
|
test_delete \
|
||||||
|
test_expand \
|
||||||
test_hardcopy \
|
test_hardcopy \
|
||||||
test_increment \
|
test_increment \
|
||||||
test_lispwords \
|
test_lispwords \
|
||||||
|
@@ -5543,7 +5543,7 @@ find_file_in_path_option(ptr, len, options, first, path_option,
|
|||||||
/* copy file name into NameBuff, expanding environment variables */
|
/* copy file name into NameBuff, expanding environment variables */
|
||||||
save_char = ptr[len];
|
save_char = ptr[len];
|
||||||
ptr[len] = NUL;
|
ptr[len] = NUL;
|
||||||
expand_env(ptr, NameBuff, MAXPATHL);
|
expand_env_esc(ptr, NameBuff, MAXPATHL, FALSE, TRUE, NULL);
|
||||||
ptr[len] = save_char;
|
ptr[len] = save_char;
|
||||||
|
|
||||||
vim_free(ff_file_to_find);
|
vim_free(ff_file_to_find);
|
||||||
|
@@ -1,20 +0,0 @@
|
|||||||
Test for expanding file names
|
|
||||||
|
|
||||||
STARTTEST
|
|
||||||
:!mkdir Xdir1
|
|
||||||
:!mkdir Xdir2
|
|
||||||
:!mkdir Xdir3
|
|
||||||
:cd Xdir3
|
|
||||||
:!mkdir Xdir4
|
|
||||||
:cd ..
|
|
||||||
:w Xdir1/file
|
|
||||||
:w Xdir3/Xdir4/file
|
|
||||||
:n Xdir?/*/file
|
|
||||||
Go%:.w! test.out
|
|
||||||
:n! Xdir?/*/nofile
|
|
||||||
Go%:.w >>test.out
|
|
||||||
:e! xx
|
|
||||||
:!rm -rf Xdir1 Xdir2 Xdir3
|
|
||||||
:qa!
|
|
||||||
ENDTEST
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
Xdir3/Xdir4/file
|
|
||||||
Xdir?/*/nofile
|
|
@@ -4,6 +4,7 @@
|
|||||||
source test_backspace_opt.vim
|
source test_backspace_opt.vim
|
||||||
source test_cursor_func.vim
|
source test_cursor_func.vim
|
||||||
source test_delete.vim
|
source test_delete.vim
|
||||||
|
source test_expand.vim
|
||||||
source test_lispwords.vim
|
source test_lispwords.vim
|
||||||
source test_menu.vim
|
source test_menu.vim
|
||||||
source test_searchpos.vim
|
source test_searchpos.vim
|
||||||
|
36
src/testdir/test_expand.vim
Normal file
36
src/testdir/test_expand.vim
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
" Test for expanding file names
|
||||||
|
|
||||||
|
func Test_with_directories()
|
||||||
|
call mkdir('Xdir1')
|
||||||
|
call mkdir('Xdir2')
|
||||||
|
call mkdir('Xdir3')
|
||||||
|
cd Xdir3
|
||||||
|
call mkdir('Xdir4')
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
split Xdir1/file
|
||||||
|
call setline(1, ['a', 'b'])
|
||||||
|
w
|
||||||
|
w Xdir3/Xdir4/file
|
||||||
|
close
|
||||||
|
|
||||||
|
next Xdir?/*/file
|
||||||
|
call assert_equal('Xdir3/Xdir4/file', expand('%'))
|
||||||
|
next! Xdir?/*/nofile
|
||||||
|
call assert_equal('Xdir?/*/nofile', expand('%'))
|
||||||
|
|
||||||
|
call delete('Xdir1', 'rf')
|
||||||
|
call delete('Xdir2', 'rf')
|
||||||
|
call delete('Xdir3', 'rf')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_with_tilde()
|
||||||
|
let dir = getcwd()
|
||||||
|
call mkdir('Xdir ~ dir')
|
||||||
|
call assert_true(isdirectory('Xdir ~ dir'))
|
||||||
|
cd Xdir\ ~\ dir
|
||||||
|
call assert_true(getcwd() =~ 'Xdir \~ dir')
|
||||||
|
exe 'cd ' . fnameescape(dir)
|
||||||
|
call delete('Xdir ~ dir', 'd')
|
||||||
|
call assert_false(isdirectory('Xdir ~ dir'))
|
||||||
|
endfunc
|
@@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
1108,
|
||||||
/**/
|
/**/
|
||||||
1107,
|
1107,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user