From 5c3bbb67e7c59b2fa18e37fdd9845a0e7e3381db Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 11 Jul 2022 20:55:26 +0800 Subject: vim-patch:8.2.3363: when :edit reuses the current buffer the alternate file is set (#19306) Problem: When :edit reuses the current buffer the alternate file is set to the same buffer. Solution: Only set the alternate file when not reusing the buffer. (closes vim/vim#8783) https://github.com/vim/vim/commit/b8bd2e6ebab03baf2672067067a599df69a278c0 Cherry-pick Test_cmdline_expand_special() from patches 8.2.{0243,2873}. Move Test_cmd_backtick() to the right place. --- src/nvim/testdir/test_cmdline.vim | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/nvim/testdir/test_cmdline.vim') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 4207e4767e..9885d356fd 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -1328,14 +1328,6 @@ func Test_cmdwin_jump_to_win() call assert_equal(1, winnr('$')) endfunc -" Test for backtick expression in the command line -func Test_cmd_backtick() - %argd - argadd `=['a', 'b', 'c']` - call assert_equal(['a', 'b', 'c'], argv()) - %argd -endfunc - func Test_cmdlineclear_tabenter() " See test/functional/legacy/cmdline_spec.lua CheckScreendump @@ -1355,6 +1347,32 @@ func Test_cmdlineclear_tabenter() call delete('XtestCmdlineClearTabenter') endfunc +" Test for expanding special keywords in cmdline +func Test_cmdline_expand_special() + new + %bwipe! + call assert_fails('e #', 'E194:') + call assert_fails('e ', 'E495:') + call assert_fails('e ', 'E496:') + call assert_fails('e ', 'E497:') + call writefile([], 'Xfile.cpp') + call writefile([], 'Xfile.java') + new Xfile.cpp + call feedkeys(":e %:r\\\"\", 'xt') + call assert_equal('"e Xfile.cpp Xfile.java', @:) + close + call delete('Xfile.cpp') + call delete('Xfile.java') +endfunc + +" Test for backtick expression in the command line +func Test_cmd_backtick() + %argd + argadd `=['a', 'b', 'c']` + call assert_equal(['a', 'b', 'c'], argv()) + %argd +endfunc + func Test_cmdwin_tabpage() tabedit " v8.2.1919 isn't ported yet, so E492 is thrown after E11 here. -- cgit