1
0
forked from aniani/vim

patch 8.2.2946: Vim9: substitute expression cannot be a List

Problem:    Vim9: substitute expression cannot be a List in a :def function.
Solution:   Use typval2string(). (closes #8330)
This commit is contained in:
Bram Moolenaar
2021-06-05 21:36:19 +02:00
parent 59b262362f
commit 2752360646
3 changed files with 10 additions and 1 deletions

View File

@@ -1236,6 +1236,13 @@ def Test_substitute_expr()
END
CheckScriptSuccess(lines)
unlet g:cond
# List results in multiple lines
new
setline(1, 'some text here')
s/text/\=['aaa', 'bbb', 'ccc']/
assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$'))
bwipe!
enddef
def Test_redir_to_var()

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2946,
/**/
2945,
/**/

View File

@@ -4130,7 +4130,7 @@ exe_substitute_instr(void)
{
typval_T *tv = STACK_TV_BOT(-1);
res = vim_strsave(tv_get_string(tv));
res = typval2string(tv, TRUE);
--ectx->ec_stack.ga_len;
clear_tv(tv);
}