From d69feeae1000db7c099daf327e026b762097c827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Garramu=C3=B1o?= Date: Mon, 11 Mar 2024 21:30:27 -0300 Subject: [PATCH] Catch Shift + Enter key before it goes to MultilineInput. --- mrv2/lib/mrvWidgets/mrvMultilineInput.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mrv2/lib/mrvWidgets/mrvMultilineInput.cpp b/mrv2/lib/mrvWidgets/mrvMultilineInput.cpp index 999ee9595..c5278cad4 100644 --- a/mrv2/lib/mrvWidgets/mrvMultilineInput.cpp +++ b/mrv2/lib/mrvWidgets/mrvMultilineInput.cpp @@ -231,10 +231,19 @@ namespace mrv return 1; } + int rawkey = Fl::event_key(); + if (e == FL_KEYBOARD && + ((rawkey == FL_KP_Enter || + rawkey == FL_Enter) && Fl::event_shift())) + { + Fl_Widget_Tracker wp(this); // watch myself + accept(); + return 1; + } + const int ret = Fl_Multiline_Input::handle(e); if (e == FL_KEYBOARD) { - int rawkey = Fl::event_key(); // If user pressed ESC, cancel the text input. if (rawkey == FL_Escape) { @@ -243,13 +252,6 @@ namespace mrv accept(); // With no text accept will return 0 return 1; } - else if ((rawkey == FL_KP_Enter || - rawkey == FL_Enter) && Fl::event_shift()) - { - Fl_Widget_Tracker wp(this); // watch myself - accept(); - return 1; - } recalc(); return ret; }