From 4595841b32d8a3782a00ac7c1cd0ceaadb8bd567 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 12:36:28 +0000 Subject: [PATCH] Decompile fn_17789 (TextInputBuffer::AdvanceCursor) Batch #1387 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_17789 TextInputBuffer::AdvanceCursor: logic confirmed by peer review Peer-reviewed-by: Yommy Reviewed-by: ragnarok-clanker --- Source/Client/Input/TextInputBuffer.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Source/Client/Input/TextInputBuffer.cpp b/Source/Client/Input/TextInputBuffer.cpp index 01cd21d5..d7e6cb83 100644 --- a/Source/Client/Input/TextInputBuffer.cpp +++ b/Source/Client/Input/TextInputBuffer.cpp @@ -209,8 +209,27 @@ void TextInputBuffer::MoveForward(unsigned codePage) { this->cursor = static_cast(CharNextExA(static_cast(codePage), begin + position, 0) - begin); } } - // OFFSET: 0x00ACE5E0 +// FUNCTION: fn_17789 +void TextInputBuffer::AdvanceCursor(int delta) { + const unsigned length = static_cast(this->text.size()); + unsigned cursor = static_cast(this->cursor); + if (cursor == length) { + return; + } + if (cursor > length) { + this->cursor = static_cast(length); + } else { + unsigned next = cursor + static_cast(delta); + if (next <= length) { + this->cursor = static_cast(next); + } + } + if ((static_cast(GetKeyState(VK_SHIFT)) >> 8) == 0) { + this->anchor = this->cursor; + } +} + // OFFSET: 0x00ACE620 // FUNCTION: fn_17790 void TextInputBuffer::RetreatCursor(int delta) {