mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Vanilla's EditBox registry has 48 methods (HighlightText, Insert, SetText, ...) but no cursor accessor, so modern addons that set text then place the caret error with "attempt to call method 'SetCursorPosition' (a nil value)" (reported: TwitchEmotes autocomplete). The caret already exists in the engine — a byte offset at editbox+0x36c — with reusable primitives: FUN_0077e360 clamps and sets it (the engine's own "restore caret" step in the insert path), FUN_0077ccf0 collapses the selection onto it. Modern SetCursorPosition is byte-based too, so it maps 1:1. New EditBox::Cursor module registers both methods on the EditBox method registry (0x00CF5378); registering under that context means only EditBox frames dispatch them, so `this` is always a real CSimpleEditBox. Set path: clamp+set the caret, collapse the selection, flag the highlight dirty. Verified in-game: SetText + SetCursorPosition + GetCursorPosition round-trips and the caret lands at the requested offset.