1
0
mirror of synced 2024-11-28 01:20:51 +01:00

fix: String truncating being completely borken

This commit is contained in:
WerWolv 2024-06-28 18:29:10 +02:00
parent 77301fd018
commit 19e5aafc85

View File

@ -693,8 +693,7 @@ namespace hex {
it = string.begin() + maxLength / 2;
// Try to find a UTF-8 character boundary
while (it != string.begin() && (*it & 0x80) == 0x00) --it;
--it;
while (it != string.begin() && (*it & 0xC0) == 0x80) --it;
}
// If we still didn't find a valid boundary, just return the string as is
@ -712,8 +711,7 @@ namespace hex {
it = string.end() - 1 - maxLength / 2;
// Try to find a UTF-8 character boundary
while (it != string.end() && (*it & 0x80) == 0x00) ++it;
++it;
while (it != string.end() && (*it & 0xC0) == 0x80) ++it;
}
return result + std::string(it, string.end());