fix: manually changing textbox.caret does not reset selection

This commit is contained in:
MihailRis 2026-04-29 23:30:19 +03:00
parent 7fb51526fd
commit 843cc3769d
2 changed files with 2 additions and 1 deletions

View file

@ -77,7 +77,6 @@ namespace gui {
void setTextOffset(uint x);
bool eraseSelected();
void resetSelection();
void extendSelection(int index);
void tokenSelectAt(int index);
size_t getLineLength(uint line) const;
@ -106,6 +105,7 @@ namespace gui {
void paste(const std::wstring& text, bool history=true);
void erase(size_t start, size_t length);
void resetSelection();
virtual void setTextSupplier(wstringsupplier supplier);

View file

@ -759,6 +759,7 @@ static void p_set_text(UINode* node, lua::State* L, int idx) {
static void p_set_caret(UINode* node, lua::State* L, int idx) {
if (auto box = dynamic_cast<TextBox*>(node)) {
box->setCaret(static_cast<ptrdiff_t>(lua::tointeger(L, idx)));
box->resetSelection();
}
}
static void p_set_editable(UINode* node, lua::State* L, int idx) {