summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c12
-rw-r--r--src/ui/inputwidget.c11
-rw-r--r--src/ui/util.c21
3 files changed, 30 insertions, 14 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 1504426f..b041f5b4 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1887,10 +1887,14 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
1887 /* The line break and URL length counters are positioned differently on mobile. 1887 /* The line break and URL length counters are positioned differently on mobile.
1888 There is no line breaks in sensitive input. */ 1888 There is no line breaks in sensitive input. */
1889 if (deviceType_App() == desktop_AppDeviceType) { 1889 if (deviceType_App() == desktop_AppDeviceType) {
1890 lineBreak = new_LabelWidget("${dlg.input.linebreak}" 1890 iString *keyStr = collectNew_String();
1891 uiTextAction_ColorEscape 1891 toString_Sym(SDLK_RETURN,
1892 " " shiftReturn_Icon, 1892 lineBreakKeyMod_ReturnKeyBehavior(prefs_App()->returnKey),
1893 NULL); 1893 keyStr);
1894 lineBreak = new_LabelWidget(
1895 format_CStr("${dlg.input.linebreak}" uiTextAction_ColorEscape " %s",
1896 cstr_String(keyStr)),
1897 NULL);
1894 insertChildAfter_Widget(buttons, iClob(lineBreak), 0); 1898 insertChildAfter_Widget(buttons, iClob(lineBreak), 0);
1895 } 1899 }
1896 else { 1900 else {
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);
diff --git a/src/ui/util.c b/src/ui/util.c
index da7a69b4..63600557 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -169,6 +169,13 @@ int keyMods_Sym(int kmods) {
169 return kmods; 169 return kmods;
170} 170}
171 171
172int keyMod_ReturnKeyFlag(int flag) {
173 flag &= mask_ReturnKeyFlag;
174 const int kmods[4] = { 0, KMOD_SHIFT, KMOD_CTRL, KMOD_GUI };
175 if (flag < 0 || flag >= iElemCount(kmods)) return 0;
176 return kmods[flag];
177}
178
172int openTabMode_Sym(int kmods) { 179int openTabMode_Sym(int kmods) {
173 const int km = keyMods_Sym(kmods); 180 const int km = keyMods_Sym(kmods);
174 return (km == KMOD_SHIFT ? otherRoot_OpenTabFlag : 0) | /* open to the side */ 181 return (km == KMOD_SHIFT ? otherRoot_OpenTabFlag : 0) | /* open to the side */
@@ -1307,12 +1314,14 @@ iWidget *makeValueInput_Widget(iWidget *parent, const iString *initialValue, con
1307 setId_Widget(as_Widget(input), "input"); 1314 setId_Widget(as_Widget(input), "input");
1308 updateValueInputWidth_(dlg); 1315 updateValueInputWidth_(dlg);
1309 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); 1316 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI)));
1310 addChild_Widget( 1317 addChild_Widget(dlg,
1311 dlg, 1318 iClob(makeDialogButtons_Widget(
1312 iClob(makeDialogButtons_Widget( 1319 (iMenuItem[]){ { "${cancel}", SDLK_ESCAPE, 0, "valueinput.cancel" },
1313 (iMenuItem[]){ { "${cancel}", SDLK_ESCAPE, 0, "valueinput.cancel" }, 1320 { acceptLabel,
1314 { acceptLabel, 0, 0, "valueinput.accept" } }, 1321 SDLK_RETURN,
1315 2))); 1322 acceptKeyMod_ReturnKeyBehavior(prefs_App()->returnKey),
1323 "valueinput.accept" } },
1324 2)));
1316 finalizeSheet_Mobile(dlg); 1325 finalizeSheet_Mobile(dlg);
1317 if (parent) { 1326 if (parent) {
1318 setFocus_Widget(as_Widget(input)); 1327 setFocus_Widget(as_Widget(input));