From a7cd63351f1954d9fcf8d7613b4467e6f11e5e60 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 5 Feb 2020 00:35:00 -0500 Subject: [PATCH] Make TextField consume all select-key actions. --- src/ui/TextField.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index c7ca2b05..f352efd5 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -178,10 +178,17 @@ void TextField::onSelectKey(const event::SelectKey& e) { else if ((GLFW_KEY_SPACE <= e.key && e.key <= GLFW_KEY_WORLD_2) || (GLFW_KEY_KP_0 <= e.key && e.key <= GLFW_KEY_KP_EQUAL)) { e.consume(this); } + else if (e.key == GLFW_KEY_ESCAPE && (e.mods & RACK_MOD_MASK) == 0) { + APP->event->setSelected(NULL); + e.consume(this); + } cursor = math::clamp(cursor, 0, (int) text.size()); selection = math::clamp(selection, 0, (int) text.size()); } + + // Consume ALL keys with ALL actions. Is this bad? I don't know, need more testing. + e.consume(this); } void TextField::insertText(std::string text) {