summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 4953cefda..9e64087b0 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2429,9 +2429,14 @@ EventState Window::HandleEditBoxKey(int wid, uint16 key, uint16 keycode)
break;
case QueryString::ACTION_CLEAR:
- query->text.DeleteAll();
- this->SetWidgetDirty(wid);
- this->OnEditboxChanged(wid);
+ if (query->text.bytes <= 1) {
+ /* If already empty, unfocus instead */
+ this->UnfocusFocusedWidget();
+ } else {
+ query->text.DeleteAll();
+ this->SetWidgetDirty(wid);
+ this->OnEditboxChanged(wid);
+ }
break;
default: