diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index fa401ad79b..956252064c 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -53,7 +53,7 @@ private: int32_t _cursorBlink{}; size_t _maxInputLength{}; - std::string _buffer; + std::vector _buffer; public: void OnOpen() override @@ -105,7 +105,8 @@ public: void SetText(std::string_view text, size_t maxLength) { - _buffer = String::UTF8Truncate(text, maxLength); + _buffer.resize(maxLength); + safe_strcpy(_buffer.data(), std::string(text).c_str(), maxLength); _maxInputLength = maxLength; gTextInput = context_start_text_input(_buffer.data(), maxLength); } @@ -215,7 +216,7 @@ public: screenCoords.y += 25; char wrapped_string[TEXT_INPUT_SIZE]; - safe_strcpy(wrapped_string, _buffer.data(), TEXT_INPUT_SIZE); + safe_strcpy(wrapped_string, _buffer.data(), _buffer.size()); // String length needs to add 12 either side of box // +13 for cursor when max length.