From ee56f3f119c4378a5b62b4d504cff3373b363308 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Oct 2021 12:34:27 +0100 Subject: patch 8.2.3559: loop variable recreated every time Problem: Loop variable recreated every time. Solution: Keep the loop variable when looping. --- src/ex_eval.c | 5 +++-- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ex_eval.c b/src/ex_eval.c index 1142280bae..1f66e336f6 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -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; diff --git a/src/version.c b/src/version.c index 53ceef0bf6..4381877f35 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3559, /**/ 3558, /**/ -- cgit v1.2.3