From 9439996e253e6e0ab5dd5b8aab59348fae9702ba Mon Sep 17 00:00:00 2001 From: Tristan Cormier Date: Sun, 30 Nov 2025 11:55:50 -0500 Subject: [PATCH] chore(ui): name parameters of CSimpleEditBox::Insert --- src/ui/CSimpleEditBox.cpp | 42 +++++++++++++++++++-------------------- src/ui/CSimpleEditBox.hpp | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/ui/CSimpleEditBox.cpp b/src/ui/CSimpleEditBox.cpp index 04f50f5..d488463 100644 --- a/src/ui/CSimpleEditBox.cpp +++ b/src/ui/CSimpleEditBox.cpp @@ -502,7 +502,7 @@ void CSimpleEditBox::Insert(uint32_t chr) { } } -void CSimpleEditBox::Insert(const char* a2, const char* a3, int32_t a4, int32_t a5, int32_t a6) { +void CSimpleEditBox::Insert(const char* utf8string, const char* taintedstring, int32_t dispatchEvent, int32_t isIME, int32_t userInput) { if ( (this->m_textInfo[this->m_cursorPos] & 0x80000000) && this->m_cursorPos > 0 @@ -512,49 +512,49 @@ void CSimpleEditBox::Insert(const char* a2, const char* a3, int32_t a4, int32_t } if (this->m_highlightLeft != this->m_highlightRight) { - this->DeleteHighlight(a6); + this->DeleteHighlight(userInput); } - if (!a2) { - a2 = ""; + if (!utf8string) { + utf8string = ""; } - const char* v10 = a2; + const char* v10 = utf8string; - if (this->m_numeric && !a5 && *v10) { + if (this->m_numeric && !isIME && *v10) { while (*v10) { - int32_t v33; + int32_t chars; - if (SUniSGetUTF8(reinterpret_cast(a2), &v33) - 48 > 9) { + if (SUniSGetUTF8(reinterpret_cast(utf8string), &chars) - 48 > 9) { return; } - v10 += v33; + v10 += chars; } } - int32_t v11 = SStrLen(a2); + int32_t amount = SStrLen(utf8string); - this->GrowText(this->m_textLength + v11); + this->GrowText(this->m_textLength + amount); - char* v14 = this->m_text + this->m_cursorPos; + char* insertPos = this->m_text + this->m_cursorPos; if (this->m_cursorPos < this->m_textLength) { - memcpy(v14 + v11, v14, this->m_textLength - this->m_cursorPos); + memcpy(insertPos + amount, insertPos, this->m_textLength - this->m_cursorPos); } - memcpy(v14, a2, v11); + memcpy(insertPos, utf8string, amount); - this->m_textLength += v11; + this->m_textLength += amount; *(this->m_text + this->m_textLength) = 0; int32_t v31 = this->m_cursorPos; - this->m_cursorPos += v11; + this->m_cursorPos += amount; this->UpdateTextInfo(); this->m_dirtyFlags |= (0x1 | 0x4); - a6 ? this->m_dirtyFlags &= ~0x8 : this->m_dirtyFlags |= 0x8; + userInput ? this->m_dirtyFlags &= ~0x8 : this->m_dirtyFlags |= 0x8; if (this->m_textLengthMax >= 0 && this->m_textLength > this->m_textLengthMax) { // TODO @@ -564,7 +564,7 @@ void CSimpleEditBox::Insert(const char* a2, const char* a3, int32_t a4, int32_t // TODO } - if (a5) { + if (isIME) { this->m_highlightLeft = v31; this->m_highlightRight = std::min(this->m_textLength, this->m_cursorPos); this->m_dirtyFlags |= 2u; @@ -572,11 +572,11 @@ void CSimpleEditBox::Insert(const char* a2, const char* a3, int32_t a4, int32_t // TODO // if (!this->m_intC && this->m_textLength > 0) { - // this->m_intC = a3; + // this->m_intC = taintedstring; // } - if (a4) { - this->RunOnCharScript(a2); + if (dispatchEvent) { + this->RunOnCharScript(utf8string); // TODO // - check for spaces and run onSpacePressed script diff --git a/src/ui/CSimpleEditBox.hpp b/src/ui/CSimpleEditBox.hpp index a876e97..91a0a84 100644 --- a/src/ui/CSimpleEditBox.hpp +++ b/src/ui/CSimpleEditBox.hpp @@ -103,7 +103,7 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame { int32_t GetNumToLen(int32_t offset, int32_t amount, bool a4); void GrowText(int32_t size); void Insert(uint32_t chr); - void Insert(const char* a2, const char* a3, int32_t a4, int32_t a5, int32_t a6); + void Insert(const char* utf8string, const char* taintedstring, int32_t dispatchEvent, int32_t isIME, int32_t userInput); int32_t IsCurrentFocus(); void Move(int32_t distance, int32_t highlight); void MoveBackward(int32_t highlight);