mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
fix: manually changing textbox.caret does not reset selection
This commit is contained in:
parent
7fb51526fd
commit
843cc3769d
2 changed files with 2 additions and 1 deletions
|
|
@ -77,7 +77,6 @@ namespace gui {
|
||||||
|
|
||||||
void setTextOffset(uint x);
|
void setTextOffset(uint x);
|
||||||
bool eraseSelected();
|
bool eraseSelected();
|
||||||
void resetSelection();
|
|
||||||
void extendSelection(int index);
|
void extendSelection(int index);
|
||||||
void tokenSelectAt(int index);
|
void tokenSelectAt(int index);
|
||||||
size_t getLineLength(uint line) const;
|
size_t getLineLength(uint line) const;
|
||||||
|
|
@ -106,6 +105,7 @@ namespace gui {
|
||||||
|
|
||||||
void paste(const std::wstring& text, bool history=true);
|
void paste(const std::wstring& text, bool history=true);
|
||||||
void erase(size_t start, size_t length);
|
void erase(size_t start, size_t length);
|
||||||
|
void resetSelection();
|
||||||
|
|
||||||
virtual void setTextSupplier(wstringsupplier supplier);
|
virtual void setTextSupplier(wstringsupplier supplier);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
static void p_set_caret(UINode* node, lua::State* L, int idx) {
|
||||||
if (auto box = dynamic_cast<TextBox*>(node)) {
|
if (auto box = dynamic_cast<TextBox*>(node)) {
|
||||||
box->setCaret(static_cast<ptrdiff_t>(lua::tointeger(L, idx)));
|
box->setCaret(static_cast<ptrdiff_t>(lua::tointeger(L, idx)));
|
||||||
|
box->resetSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void p_set_editable(UINode* node, lua::State* L, int idx) {
|
static void p_set_editable(UINode* node, lua::State* L, int idx) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue