diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-04 17:42:34 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-05-04 17:49:56 +0800 |
commit | 3724e65c30f7d1ef803ac4e34eab7d4a9531b1a8 (patch) | |
tree | 6ddfb2294ae444c18f81f670500ea3f0f6fb5d88 /runtime | |
parent | b441dafdf53e367c7d43177274bd781c5c73e6e0 (diff) | |
download | rneovim-3724e65c30f7d1ef803ac4e34eab7d4a9531b1a8.tar.gz rneovim-3724e65c30f7d1ef803ac4e34eab7d4a9531b1a8.tar.bz2 rneovim-3724e65c30f7d1ef803ac4e34eab7d4a9531b1a8.zip |
vim-patch:8.2.2607: strcharpart() cannot include composing characters
Problem: strcharpart() cannot include composing characters.
Solution: Add the {skipcc} argument.
https://github.com/vim/vim/commit/02b4d9b18a03549b68e364e428392b7a62766c74
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 5be9ba910b..c2dc5ddd5b 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -486,7 +486,7 @@ str2list({expr} [, {utf8}]) List convert each character of {expr} to str2nr({expr} [, {base} [, {quoted}]]) Number convert String to Number strcharlen({expr}) Number character length of the String {expr} -strcharpart({str}, {start} [, {len}]) +strcharpart({str}, {start} [, {len} [, {skipcc}]]) String {len} characters of {str} at character {start} strchars({expr} [, {skipcc}]) Number character count of the String {expr} @@ -7779,6 +7779,7 @@ 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. 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. @@ -8129,12 +8130,16 @@ strcharlen({string}) *strcharlen()* GetText()->strcharlen() -strcharpart({src}, {start} [, {len}]) *strcharpart()* +strcharpart({src}, {start} [, {len} [, {skipcc}]]) *strcharpart()* Like |strpart()| but using character index and length instead - of byte index and length. Composing characters are counted - separately. + 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 a character index is used where a character does not - exist it is assumed to be one character. For example: > + exist it is omitted and counted as one character. For + example: > strcharpart('abc', -1, 2) < results in 'a'. |