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

patch 8.2.3559: loop variable recreated every time

Problem:    Loop variable recreated every time.
Solution:   Keep the loop variable when looping.
This commit is contained in:
Bram Moolenaar
2021-10-23 12:34:27 +01:00
parent 079ba76ae7
commit ee56f3f119
2 changed files with 5 additions and 2 deletions

View 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;