diff options
author | frosch <frosch@openttd.org> | 2013-08-03 21:26:49 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-08-03 21:26:49 +0000 |
commit | a3efc99034ad933b70fb3af4ca9be267468ad221 (patch) | |
tree | 9086a32c33c5bebb9db2d2fd102aeeb9f2187c99 | |
parent | c47ef21af041a165d137860b75b475bc0e68fa22 (diff) | |
download | openttd-a3efc99034ad933b70fb3af4ca9be267468ad221.tar.xz |
(svn r25647) -Add: If an editbox is configured to be cleared with ESC, but the editbox is already empty, unselect the editbox instead.
-rw-r--r-- | src/window.cpp | 11 |
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: |