diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-23 16:33:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-23 16:33:53 +0800 |
commit | 881f5e59173a4f1b9a4cb16e425709e40d79d0e9 (patch) | |
tree | c6bab71f98cc606182c29f81f7d454d6a36cacb6 /runtime/doc | |
parent | 2955c921ceaf5764e8d1592a78370d9ca3a268e2 (diff) | |
download | rneovim-881f5e59173a4f1b9a4cb16e425709e40d79d0e9.tar.gz rneovim-881f5e59173a4f1b9a4cb16e425709e40d79d0e9.tar.bz2 rneovim-881f5e59173a4f1b9a4cb16e425709e40d79d0e9.zip |
vim-patch:9.1.0199: Not enough tests for the slice() function (#27991)
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: vim/vim#14275
https://github.com/vim/vim/commit/ad38769030b5fa86aa0e8f1f0b4266690dfad4c9
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/builtin.txt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index be81451d08..c88513ad75 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -7411,7 +7411,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. - Also, composing characters are not counted. + 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. @@ -7758,8 +7759,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: >vim @@ -7773,7 +7774,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. |