mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Merge pull request #14355 from duncanspumpkin/fix_14353
Fix #14353. Provide a buffer for text input
This commit is contained in:
@@ -53,7 +53,7 @@ private:
|
||||
|
||||
int32_t _cursorBlink{};
|
||||
size_t _maxInputLength{};
|
||||
std::string _buffer;
|
||||
std::vector<utf8> _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.
|
||||
|
||||
Reference in New Issue
Block a user