From 8a845ab3efd87e3c49e4b756a0e74f8e06303fb1 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 11 Sep 2018 22:39:15 -0400 Subject: vim-patch:8.1.0219: expanding ## fails to escape backtick Problem: Expanding ## fails to escape backtick. Solution: Escape a backtick in a file name. (closes vim/vim#3257) https://github.com/vim/vim/commit/2c8c681bfcd5138a0ec8ce018216dc2dc69a11a0 --- src/nvim/ex_docmd.c | 2 +- src/nvim/testdir/test_edit.vim | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 03f1446265..6586d82fae 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8735,7 +8735,7 @@ static char_u *arg_all(void) #ifndef BACKSLASH_IN_FILENAME || *p == '\\' #endif - ) { + || *p == '`') { // insert a backslash if (retval != NULL) { retval[len] = '\\'; diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index 989adfce8f..b1fce07f39 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -1338,6 +1338,14 @@ func! Test_edit_rightleft() bw! endfunc +func Test_edit_backtick() + next a\`b c + call assert_equal('a`b', expand('%')) + next + call assert_equal('c', expand('%')) + call assert_equal('a\`b c', expand('##')) +endfunc + func Test_edit_quit() edit foo.txt split -- cgit