1
0
forked from aniani/vim

patch 9.0.1629: having utf16idx() rounding up is inconvenient

Problem:    Having utf16idx() rounding up is inconvenient.
Solution:   Make utf16idx() round down. (Yegappan Lakshmanan, closes #12523)
This commit is contained in:
Yegappan Lakshmanan
2023-06-14 13:10:15 +01:00
committed by Bram Moolenaar
parent d5b952a871
commit 95707037af
4 changed files with 20 additions and 14 deletions

View File

@@ -10127,8 +10127,8 @@ utf16idx({string}, {idx} [, {countcc} [, {charidx}]])
When {charidx} is present and TRUE, {idx} is used as the
character index in the String {string} instead of as the byte
index.
An {idx} in the middle of a UTF-8 sequence is rounded upwards
to the end of that sequence.
An {idx} in the middle of a UTF-8 sequence is rounded
downwards to the beginning of that sequence.
Returns -1 if the arguments are invalid or if there are less
than {idx} bytes in {string}. If there are exactly {idx} bytes