summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-05 19:23:28 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-05 19:23:28 +0100
commitecac591cce23919059a5d93ed2e94541b1be99b5 (patch)
tree911580be45a1b9c47d876ada0ecf5076eafac8ec /src
parenta79925a0a8f00577782090859eb0ef69e220d4aa (diff)
patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopenv8.2.2303
Problem: Vim9: backtick expansion doesn't work for :foldopen. Solution: Do recognize backtick expansion. (closes #7621)
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_vim9_cmd.vim17
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c7
3 files changed, 26 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim
index c9e83d9bca..5b84feceea 100644
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -81,6 +81,23 @@ def Test_global_backtick_expansion()
bwipe!
enddef
+def Test_folddo_backtick_expansion()
+ new
+ var name = 'xxx'
+ folddoopen edit `=name`
+ assert_equal('xxx', bufname())
+ bwipe!
+
+ new
+ setline(1, ['one', 'two'])
+ set nomodified
+ :1,2fold
+ foldclose
+ folddoclose edit `=name`
+ assert_equal('xxx', bufname())
+ bwipe!
+enddef
+
def Test_hardcopy_wildcards()
CheckUnix
CheckFeature postscript
diff --git a/src/version.c b/src/version.c
index e7c3ee0a0d..a2553fcc4a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2303,
+/**/
2302,
/**/
2301,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index cf5cff8598..67307f8a93 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -7505,6 +7505,13 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
}
}
+ if (eap->cmdidx == CMD_folddoopen || eap->cmdidx == CMD_folddoclosed)
+ {
+ // TODO: should only expand when appropriate for the command
+ eap->arg = skiptowhite(eap->arg);
+ has_expr = TRUE;
+ }
+
if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL)
{
int count = 0;