diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-24 15:03:28 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-02-24 15:36:08 +0800 |
commit | 904d0995837a2569ae640f5253da3dd4569fec6f (patch) | |
tree | cf18e60265b26ed416e71c64b0370c3cb436e73e /runtime | |
parent | 47bc297d81cf7dab5a28608657ddab3c09f794d0 (diff) | |
download | rneovim-904d0995837a2569ae640f5253da3dd4569fec6f.tar.gz rneovim-904d0995837a2569ae640f5253da3dd4569fec6f.tar.bz2 rneovim-904d0995837a2569ae640f5253da3dd4569fec6f.zip |
vim-patch:8.2.2449: Vim9: flatten() always changes the list type
Problem: Vim9: flatten() always changes the list type.
Solution: Disallow using flatten() and add flattennew().
https://github.com/vim/vim/commit/3b690069730805a147d45d92eaca4dc838272d1d
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 8 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index af5ba9ab8f..5f279ed09c 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -148,6 +148,8 @@ finddir({name} [, {path} [, {count}]]) findfile({name} [, {path} [, {count}]]) String find file {name} in {path} flatten({list} [, {maxdepth}]) List flatten {list} up to {maxdepth} levels +flattennew({list} [, {maxdepth}]) + List flatten a copy of {list} float2nr({expr}) Number convert Float {expr} to a Number floor({expr}) Float round {expr} down fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2} @@ -2277,7 +2279,7 @@ flatten({list} [, {maxdepth}]) *flatten()* Flatten {list} up to {maxdepth} levels. Without {maxdepth} the result is a |List| without nesting, as if {maxdepth} is a very large number. - The {list} is changed in place, make a copy first if you do + The {list} is changed in place, use |flattennew()| if you do not want that. *E900* {maxdepth} means how deep in nested lists changes are made. @@ -2295,6 +2297,10 @@ flatten({list} [, {maxdepth}]) *flatten()* Can also be used as a |method|: > mylist->flatten() < +flattennew({list} [, {maxdepth}]) *flattennew()* + Like |flatten()| but first make a copy of {list}. + + float2nr({expr}) *float2nr()* Convert {expr} to a Number by omitting the part after the decimal point. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 910aebae70..27c5927cf9 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -670,6 +670,7 @@ List manipulation: *list-functions* count() count number of times a value appears in a List repeat() repeat a List multiple times flatten() flatten a List + flattennew() flatten a copy of a List Dictionary manipulation: *dict-functions* get() get an entry without an error for a wrong key |