0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.3235: cannot use lambda in {} block in user command

Problem:    Cannot use lambda in {} block in user command. (Martin Tournoij)
Solution:   Do not go over the end of the lambda.
This commit is contained in:
Bram Moolenaar
2021-07-28 15:54:54 +02:00
parent 78e006b9b0
commit 6868634abd
3 changed files with 10 additions and 1 deletions

View File

@@ -632,6 +632,13 @@ func Test_usercmd_with_block()
call assert_equal('more', g:didmore) call assert_equal('more', g:didmore)
unlet g:didit unlet g:didit
unlet g:didmore unlet g:didmore
delcommand DoSomething
command DoMap {
echo [1, 2, 3]->map((_, v) => v + 1)
}
DoMap
delcommand DoMap
let lines =<< trim END let lines =<< trim END
command DoesNotEnd { command DoesNotEnd {

View File

@@ -1398,7 +1398,7 @@ get_lambda_tv(
// If there are line breaks, we need to split up the string. // If there are line breaks, we need to split up the string.
line_end = vim_strchr(start, '\n'); line_end = vim_strchr(start, '\n');
if (line_end == NULL) if (line_end == NULL || line_end > end)
line_end = end; line_end = end;
// Add "return " before the expression (or the first line). // Add "return " before the expression (or the first line).

View File

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