From df3640978d279b85653d647facb26ef15c509848 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 13 Jul 2025 12:30:39 +0300 Subject: [PATCH] fix: validator not called after backspace --- src/graphics/ui/elements/TextBox.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/graphics/ui/elements/TextBox.cpp b/src/graphics/ui/elements/TextBox.cpp index f271cc23..9a9177f9 100644 --- a/src/graphics/ui/elements/TextBox.cpp +++ b/src/graphics/ui/elements/TextBox.cpp @@ -830,7 +830,12 @@ void TextBox::performEditingKeyboardEvents(Keycode key) { bool shiftPressed = gui.getInput().pressed(Keycode::LEFT_SHIFT); bool breakSelection = getSelectionLength() != 0 && !shiftPressed; if (key == Keycode::BACKSPACE) { - if (!eraseSelected() && caret > 0 && input.length() > 0) { + bool erased = eraseSelected(); + if (erased) { + if (validate()) { + onInput(); + } + } else if (caret > 0 && input.length() > 0) { if (caret > input.length()) { caret = input.length(); }