mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.4886: Vim9: redir in skipped block seen as assignment
Problem: Vim9: redir in skipped block seen as assignment. Solution: Check for valid assignment.
This commit is contained in:
@@ -3683,6 +3683,7 @@ find_ex_command(
|
|||||||
// "&opt = expr"
|
// "&opt = expr"
|
||||||
// "var = expr" where "var" is a variable name or we are skipping
|
// "var = expr" where "var" is a variable name or we are skipping
|
||||||
// (variable declaration might have been skipped).
|
// (variable declaration might have been skipped).
|
||||||
|
// Not "redir => var" (when skipping).
|
||||||
oplen = assignment_len(skipwhite(p), &heredoc);
|
oplen = assignment_len(skipwhite(p), &heredoc);
|
||||||
if (oplen > 0)
|
if (oplen > 0)
|
||||||
{
|
{
|
||||||
@@ -3690,7 +3691,8 @@ find_ex_command(
|
|||||||
|| *eap->cmd == '&'
|
|| *eap->cmd == '&'
|
||||||
|| *eap->cmd == '$'
|
|| *eap->cmd == '$'
|
||||||
|| *eap->cmd == '@'
|
|| *eap->cmd == '@'
|
||||||
|| eap->skip
|
|| (eap->skip && IS_WHITE_OR_NUL(
|
||||||
|
*(skipwhite(p) + oplen)))
|
||||||
|| lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK)
|
|| lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK)
|
||||||
{
|
{
|
||||||
eap->cmdidx = CMD_var;
|
eap->cmdidx = CMD_var;
|
||||||
|
@@ -739,6 +739,14 @@ def Test_init_in_for_loop()
|
|||||||
v9.CheckDefAndScriptSuccess(lines)
|
v9.CheckDefAndScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_redir_is_not_assign()
|
||||||
|
if false
|
||||||
|
redir => res
|
||||||
|
echo var_job
|
||||||
|
redir END
|
||||||
|
endif
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_extend_list()
|
def Test_extend_list()
|
||||||
# using uninitialized list assigns empty list
|
# using uninitialized list assigns empty list
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
|
@@ -746,6 +746,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 */
|
||||||
|
/**/
|
||||||
|
4886,
|
||||||
/**/
|
/**/
|
||||||
4885,
|
4885,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user