diff --git a/CHANGELOG.md b/CHANGELOG.md index c71254b8..8f1c4b04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ ### 1.0.1 (in development) - Request microphone access on Mac to prevent Mac 10.14+ from blocking audio input. +- Clear filters in Module Browser when backspace is pressed while the search field is empty. - Fix MIDI receiving in Bridge MIDI driver. - Fix opening/saving UTF-8 filenames on Windows. -- API +- Fix bug where cable ID's were not being set in .vcv patches. +- Plugin API - Add `string::absolutePath()`. - Use namespace for Core plugin to avoid name clashes. diff --git a/src/app/ModuleBrowser.cpp b/src/app/ModuleBrowser.cpp index 8b2b2f8c..51a635aa 100644 --- a/src/app/ModuleBrowser.cpp +++ b/src/app/ModuleBrowser.cpp @@ -296,19 +296,7 @@ struct BrowserSearchField : ui::TextField { TextField::step(); } - void onSelectKey(const event::SelectKey &e) override { - if (e.action == GLFW_PRESS) { - if (e.key == GLFW_KEY_ESCAPE) { - BrowserOverlay *overlay = getAncestorOfType(); - overlay->hide(); - e.consume(this); - } - } - - if (!e.getTarget()) - ui::TextField::onSelectKey(e); - } - + void onSelectKey(const event::SelectKey &e) override; void onChange(const event::Change &e) override; void onAction(const event::Action &e) override; @@ -625,6 +613,28 @@ inline void TagItem::step() { active = (browser->tag == text); } +inline void BrowserSearchField::onSelectKey(const event::SelectKey &e) { + if (e.action == GLFW_PRESS) { + switch (e.key) { + case GLFW_KEY_ESCAPE: { + BrowserOverlay *overlay = getAncestorOfType(); + overlay->hide(); + e.consume(this); + } break; + case GLFW_KEY_BACKSPACE: { + if (text == "") { + ModuleBrowser *browser = getAncestorOfType(); + browser->clear(); + e.consume(this); + } + } break; + } + } + + if (!e.getTarget()) + ui::TextField::onSelectKey(e); +} + inline void BrowserSearchField::onChange(const event::Change &e) { ModuleBrowser *browser = getAncestorOfType(); browser->search = string::trim(text);