From c8739565332ebd11ee652040fc99e7c2f333fb08 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 4 May 2019 21:10:14 -0400 Subject: [PATCH] Make the escape key clear the ModuleBrowser search field if it contains text. --- src/app/ModuleBrowser.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/ModuleBrowser.cpp b/src/app/ModuleBrowser.cpp index 5bf86314..3eec8ed1 100644 --- a/src/app/ModuleBrowser.cpp +++ b/src/app/ModuleBrowser.cpp @@ -247,8 +247,13 @@ struct BrowserSearchField : ui::TextField { void onSelectKey(const event::SelectKey &e) override { if (e.action == GLFW_PRESS) { if (e.key == GLFW_KEY_ESCAPE) { - BrowserOverlay *overlay = getAncestorOfType(); - overlay->hide(); + if (text != "") { + setText(""); + } + else { + BrowserOverlay *overlay = getAncestorOfType(); + overlay->hide(); + } e.consume(this); } }