The byteidx() and byteidxcomp() functions return the length of a string in bytes when the specified character
index is equal to the number of characters in the string. But the charidx() function returns -1 when the specified
byte index is equal to the number of bytes in the string. Same behavior applies to the utf16idx() function also.
Make the return value of these two functions consistent with the byteidx() function.
https://github.com/vim/vim/pull/12503
(4 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@yegappan pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Merging #12503 (bc28764) into master (5bf0428) will increase coverage by
0.65%.
The diff coverage is100.00%.
@@ Coverage Diff @@ ## master #12503 +/- ## ========================================== + Coverage 82.09% 82.74% +0.65% ========================================== Files 160 150 -10 Lines 193606 180421 -13185 Branches 43469 40547 -2922 ========================================== - Hits 158933 149288 -9645 + Misses 21834 18186 -3648 - Partials 12839 12947 +108
| Flag | Coverage Δ | |
|---|---|---|
| huge-clang-none | 82.74% <100.00%> (-0.01%) |
⬇️ |
| linux | 82.74% <100.00%> (-0.01%) |
⬇️ |
| mingw-x64-HUGE | ? |
|
| mingw-x86-HUGE | ? |
|
| windows | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/evalfunc.c | 88.97% <ø> (-1.30%) |
⬇️ |
| src/strings.c | 92.94% <100.00%> (-0.46%) |
⬇️ |
... and 140 files with indirect coverage changes
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
May I ask what the motivation is for such a change? This seems counter to any programming language libraries that I'm aware of. You will end up returning an "index" that's clearly out of bounds and seems to actively encourage unsafe programming where you now have to check for length or -1 to tell if the result is invalid. Maybe I'm missing something by it seems more like byteidx is the undesired behavior here.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I guess this is to make it so that you can do something like byteidx(charidx(…)) and vice versa and have it return itself? And you are essentially using charidx double duty as a fictional strcharlen() function (since strlen() returns bytes and we don't have a function to return number of Unicode characters in a string)?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
May I ask what the motivation is for such a change? This seems counter to any programming language libraries that I'm aware of. You will end up returning an "index" that's clearly out of bounds and seems to actively encourage unsafe programming where you now have to check for length or -1 to tell if the result is invalid. Maybe I'm missing something by it seems more like byteidx is the undesired behavior here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I guess this is to make it so that you can do something like
byteidx(charidx(…))and vice versa and have it return itself? And you are essentially usingcharidxdouble duty as a fictionalstrcharlen()function (sincestrlen()returns bytes and we don't have a function to return number of Unicode characters in a string)?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()