From bc80b3741d09cfb855168182f1d0502dc64860de Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 2 Nov 2026 03:59:47 +0000 Subject: [PATCH] Decompile fn_10771 (UIEditCtrl3::TakePendingText) Batch #9862 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_10771 UIEditCtrl3::TakePendingText: logic confirmed by peer review Peer-reviewed-by: KWDev, Montyla, cremane Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Edit/UIEditCtrl.cpp | 27 ++++++++++++++++++++++++++- Source/UI/Edit/UIEditCtrl.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 28011237..d24a8ea6 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -688,7 +688,7 @@ std::string UIEditCtrl3::TakePendingText() { for (std::size_t i = 0; i < this->pendingText.size(); ++i) { result.append(this->pendingText[i]); } - this->pendingText.clear(); + this->pendingText.erase(this->pendingText.begin(), this->pendingText.end()); return result; } @@ -826,6 +826,31 @@ void UIEditCtrlWheel::Slot35(int value) { } } +// OFFSET: 0x00869E30 +void UIChatEditCtrl::PushHistory() { + if (this->Length() == 0) { + return; + } + + if (this->unknown_0140 == static_cast(this->history.size())) { + if (this->history.size() >= static_cast(this->historyLimit)) { + --this->unknown_0140; + std::move(this->history.begin() + 1, this->history.end(), this->history.begin()); + this->history.pop_back(); + } + this->history.push_back(std::string(this->Text())); + } else { + this->history[this->unknown_0140] = this->Text(); + } + + ++this->unknown_0140; + if (this->unknown_0140 == static_cast(this->history.size())) { + this->SetText(""); + } else { + this->SetText(this->history[this->unknown_0140].c_str()); + } +} + // OFFSET: 0x0086A550 // FUNCTION: fn_10977 void UIEditCtrl::MoveCandidateWindow(int x) { diff --git a/Source/UI/Edit/UIEditCtrl.h b/Source/UI/Edit/UIEditCtrl.h index b394fc30..1fb69e66 100644 --- a/Source/UI/Edit/UIEditCtrl.h +++ b/Source/UI/Edit/UIEditCtrl.h @@ -223,6 +223,7 @@ public: int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; void InsertItemTag(int tagId); void InsertItemLink(const ITEM_INFO& item); + void PushHistory(); /* 011C */ std::vector history; /* 0128 */ std::string pending;