]> granicus.if.org Git - vim/commitdiff
patch 8.2.3559: loop variable recreated every time v8.2.3559
authorBram Moolenaar <Bram@vim.org>
Sat, 23 Oct 2021 11:34:27 +0000 (12:34 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 23 Oct 2021 11:34:27 +0000 (12:34 +0100)
Problem:    Loop variable recreated every time.
Solution:   Keep the loop variable when looping.

src/ex_eval.c
src/version.c

index 1142280bae3b22f17b94667586ce0d88c365e9f9..1f66e336f66a0f7fca0ed6d9e1651bac168db7de 100644 (file)
@@ -1191,8 +1191,9 @@ ex_while(exarg_T *eap)
                                                                & CSF_FUNC_DEF;
 
                // Any variables defined in the previous round are no longer
-               // visible.
-               for (i = cstack->cs_script_var_len[cstack->cs_idx];
+               // visible.  Keep the first one, it is the loop variable that
+               // we reuse every time around.
+               for (i = cstack->cs_script_var_len[cstack->cs_idx] + 1;
                                               i < si->sn_var_vals.ga_len; ++i)
                {
                    svar_T      *sv = ((svar_T *)si->sn_var_vals.ga_data) + i;
index 53ceef0bf6f424c02d19dcbea57c20ad5d5a807d..4381877f3526c0c670e1997a4924238d16e9c75b 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3559,
 /**/
     3558,
 /**/