diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-23 08:23:48 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-03-23 08:25:41 +0100 |
commit | ad38769030b5fa86aa0e8f1f0b4266690dfad4c9 (patch) | |
tree | 2047fc01b8c70326d9b87b47a575e7e5f2141b62 /runtime | |
parent | d990bf08d85d83e14fc51fd99a66ebe2f36d2fcd (diff) |
patch 9.1.0199: Not enough tests for the slice() functionv9.1.0199
Problem: Not enough tests for the slice() function.
Solution: Test with multibyte chars, and in both Legacy and Vim9 script.
Update docs to be clearer about how it treats composing chars.
(zeertzjq)
closes: #14275
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index c857fbc3de..ec702201d5 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Mar 14 +*builtin.txt* For Vim version 9.1. Last change: 2024 Mar 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -9068,7 +9068,8 @@ slice({expr}, {start} [, {end}]) *slice()* Similar to using a |slice| "expr[start : end]", but "end" is used exclusive. And for a string the indexes are used as character indexes instead of byte indexes, like in - |vim9script|. Also, composing characters are not counted. + |vim9script|. Also, composing characters are treated as a + part of the preceding base character. When {end} is omitted the slice continues to the last item. When {end} is -1 the last item is omitted. Returns an empty value if {start} or {end} are invalid. @@ -9465,8 +9466,8 @@ strcharpart({src}, {start} [, {len} [, {skipcc}]]) *strcharpart()* of byte index and length. When {skipcc} is omitted or zero, composing characters are counted separately. - When {skipcc} set to 1, Composing characters are ignored, - similar to |slice()|. + When {skipcc} set to 1, composing characters are treated as a + part of the preceding base character, similar to |slice()|. When a character index is used where a character does not exist it is omitted and counted as one character. For example: > @@ -9484,7 +9485,7 @@ strchars({string} [, {skipcc}]) *strchars()* in String {string}. When {skipcc} is omitted or zero, composing characters are counted separately. - When {skipcc} set to 1, Composing characters are ignored. + When {skipcc} set to 1, composing characters are ignored. |strcharlen()| always does this. Returns zero on error. |