- made the menu's text input handler Unicode capable.

Also make sure that the savegame description remains readable. Unlike in-game text this can be done without double-encoding existing UTF-8.
This commit is contained in:
Christoph Oelckers 2019-02-16 21:29:46 +01:00
commit deb233677e
13 changed files with 111 additions and 30 deletions

View file

@ -39,6 +39,7 @@
#include "zstring.h"
#include "v_text.h"
#include "utf8.h"
FNullStringData FString::NullString =
{
@ -475,6 +476,28 @@ FString FString::Mid (size_t pos, size_t numChars) const
return FString (Chars + pos, numChars);
}
void FString::AppendCharacter(int codepoint)
{
(*this) << MakeUTF8(codepoint);
}
void FString::DeleteLastCharacter()
{
if (Len() == 0) return;
auto pos = Len() - 1;
while (pos > 0 && Chars[pos] >= 0x80 && Chars[pos] < 0xc0) pos--;
if (pos <= 0)
{
Data()->Release();
ResetToNull();
}
else
{
Truncate(pos);
}
}
long FString::IndexOf (const FString &substr, long startIndex) const
{
return IndexOf (substr.Chars, startIndex);