vim-patch:8.2.4627: flatten() does not use maxdepth correctly

Problem:    flatten() does not use maxdepth correctly.
Solution:   Use a recursive implementation. (closes vim/vim#10020)

acf7d73a7f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-02-24 15:24:38 +08:00
parent 904d099583
commit d9263688bf
3 changed files with 39 additions and 21 deletions

View File

@@ -1914,7 +1914,7 @@ static void flatten_common(typval_T *argvars, typval_T *rettv, bool make_copy)
tv_list_ref(list);
}
tv_list_flatten(list, maxdepth);
tv_list_flatten(list, NULL, tv_list_len(list), maxdepth);
}
/// "flatten(list[, {maxdepth}])" function