Skip to content

Commit

Permalink
Catch Shift + Enter key before it goes to MultilineInput.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Mar 12, 2024
1 parent 644e550 commit d69feea
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions mrv2/lib/mrvWidgets/mrvMultilineInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down

0 comments on commit d69feea

Please sign in to comment.