Skip to content

Commit ecac591

Browse files
committed
patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Problem: Vim9: backtick expansion doesn't work for :foldopen. Solution: Do recognize backtick expansion. (closes #7621)
1 parent a79925a commit ecac591

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/testdir/test_vim9_cmd.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ def Test_global_backtick_expansion()
8181
bwipe!
8282
enddef
8383

84+
def Test_folddo_backtick_expansion()
85+
new
86+
var name = 'xxx'
87+
folddoopen edit `=name`
88+
assert_equal('xxx', bufname())
89+
bwipe!
90+
91+
new
92+
setline(1, ['one', 'two'])
93+
set nomodified
94+
:1,2fold
95+
foldclose
96+
folddoclose edit `=name`
97+
assert_equal('xxx', bufname())
98+
bwipe!
99+
enddef
100+
84101
def Test_hardcopy_wildcards()
85102
CheckUnix
86103
CheckFeature postscript

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2303,
753755
/**/
754756
2302,
755757
/**/

src/vim9compile.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7505,6 +7505,13 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
75057505
}
75067506
}
75077507

7508+
if (eap->cmdidx == CMD_folddoopen || eap->cmdidx == CMD_folddoclosed)
7509+
{
7510+
// TODO: should only expand when appropriate for the command
7511+
eap->arg = skiptowhite(eap->arg);
7512+
has_expr = TRUE;
7513+
}
7514+
75087515
if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL)
75097516
{
75107517
int count = 0;

0 commit comments

Comments
 (0)