patch 9.1.1668: items() does not work for Blobs

Problem:  items() does not work for Blobs
Solution: Extend items() to support Blob
          (Yegappan Lakshmanan).

closes: #18080

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-08-23 06:18:34 -04:00
committed by Christian Brabandt
parent 6b56711804
commit da34f84847
13 changed files with 94 additions and 26 deletions

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2025 Aug 20
*builtin.txt* For Vim version 9.1. Last change: 2025 Aug 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -344,7 +344,7 @@ isinf({expr}) Number determine if {expr} is infinity value
(positive or negative)
islocked({expr}) Number |TRUE| if {expr} is locked
isnan({expr}) Number |TRUE| if {expr} is NaN
items({expr}) List key-value pairs in {expr}
items({expr}) List key/index-value pairs in {expr}
job_getchannel({job}) Channel get the channel handle for {job}
job_info([{job}]) Dict get information about {job}
job_setoptions({job}, {options}) none set options for {job}
@ -6314,7 +6314,8 @@ items({expr}) *items()*
Return a |List| with all key/index and value pairs of {expr}.
Each |List| item is a list with two items:
- for a |Dict|: the key and the value
- for a |List|, |Tuple| or |String|: the index and the value
- for a |List|, |Tuple|, |Blob| or |String|: the index and the
value
The returned |List| is in arbitrary order for a |Dict|,
otherwise it's in ascending order of the index.
@ -6328,6 +6329,7 @@ items({expr}) *items()*
echo items([1, 2, 3])
echo items(('a', 'b', 'c'))
echo items("foobar")
echo items(0z0102)
<
Can also be used as a |method|: >
mydict->items()

View File

@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 9.1. Last change: 2025 Aug 18
*usr_41.txt* For Vim version 9.1. Last change: 2025 Aug 23
VIM USER MANUAL - by Bram Moolenaar
@ -920,6 +920,7 @@ Blob manipulation: *blob-functions*
reverse() reverse the order of numbers in a blob
index() index of a value in a Blob
indexof() index in a Blob where an expression is true
items() get List of Blob index-value pairs
Other computation: *bitwise-function*
and() bitwise AND

View File

@ -41648,6 +41648,8 @@ Other new features ~
- Add the new default highlighting groups "Bold", "Italic" and "BoldItalic"
for use in syntax scripts.
- |items()| function now supports Blob.
*changed-9.2*
Changed~
-------