Browse Source

Make the escape key clear the ModuleBrowser search field if it contains text.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
c873956533
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/app/ModuleBrowser.cpp

+ 7
- 2
src/app/ModuleBrowser.cpp View File

@@ -247,8 +247,13 @@ struct BrowserSearchField : ui::TextField {
void onSelectKey(const event::SelectKey &e) override { void onSelectKey(const event::SelectKey &e) override {
if (e.action == GLFW_PRESS) { if (e.action == GLFW_PRESS) {
if (e.key == GLFW_KEY_ESCAPE) { if (e.key == GLFW_KEY_ESCAPE) {
BrowserOverlay *overlay = getAncestorOfType<BrowserOverlay>();
overlay->hide();
if (text != "") {
setText("");
}
else {
BrowserOverlay *overlay = getAncestorOfType<BrowserOverlay>();
overlay->hide();
}
e.consume(this); e.consume(this);
} }
} }


Loading…
Cancel
Save