diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-22 08:38:37 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-22 08:38:37 +0300 |
commit | bc07d618e27147a8510f2077d0e3708aaa467e27 (patch) | |
tree | 7441065f9b27739ae17575a795f63c204ef26577 /src/ui/inputwidget.c | |
parent | b2448c68011f310e312de61cbfea86059ef730da (diff) |
Added a setting for Return key behavior
User preference for line break / accept behavior in input fields. Still needs to be added to the Preferences dialog.
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 3a979b20..2c1c3165 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -1693,8 +1693,9 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { | |||
1693 | case SDLK_RETURN: | 1693 | case SDLK_RETURN: |
1694 | case SDLK_KP_ENTER: | 1694 | case SDLK_KP_ENTER: |
1695 | if (~d->inFlags & isSensitive_InputWidgetFlag && d->maxLen == 0) { | 1695 | if (~d->inFlags & isSensitive_InputWidgetFlag && d->maxLen == 0) { |
1696 | if (mods == KMOD_SHIFT || (~d->inFlags & isUrl_InputWidgetFlag && | 1696 | if (mods == lineBreakKeyMod_ReturnKeyBehavior(prefs_App()->returnKey) || |
1697 | d->inFlags & enterKeyInsertsLineFeed_InputWidgetFlag)) { | 1697 | (~d->inFlags & isUrl_InputWidgetFlag && |
1698 | d->inFlags & enterKeyInsertsLineFeed_InputWidgetFlag)) { | ||
1698 | pushUndo_InputWidget_(d); | 1699 | pushUndo_InputWidget_(d); |
1699 | deleteMarked_InputWidget_(d); | 1700 | deleteMarked_InputWidget_(d); |
1700 | insertChar_InputWidget_(d, '\n'); | 1701 | insertChar_InputWidget_(d, '\n'); |
@@ -1702,11 +1703,13 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { | |||
1702 | return iTrue; | 1703 | return iTrue; |
1703 | } | 1704 | } |
1704 | } | 1705 | } |
1705 | if (d->inFlags & enterKeyEnabled_InputWidgetFlag) { | 1706 | if (d->inFlags & enterKeyEnabled_InputWidgetFlag && |
1707 | mods == acceptKeyMod_ReturnKeyBehavior(prefs_App()->returnKey)) { | ||
1706 | d->inFlags |= enterPressed_InputWidgetFlag; | 1708 | d->inFlags |= enterPressed_InputWidgetFlag; |
1707 | setFocus_Widget(NULL); | 1709 | setFocus_Widget(NULL); |
1710 | return iTrue; | ||
1708 | } | 1711 | } |
1709 | return iTrue; | 1712 | return iFalse; |
1710 | case SDLK_ESCAPE: | 1713 | case SDLK_ESCAPE: |
1711 | end_InputWidget(d, iFalse); | 1714 | end_InputWidget(d, iFalse); |
1712 | setFocus_Widget(NULL); | 1715 | setFocus_Widget(NULL); |