=> bb9ce59f9885baf3acaf569e965bdf8f0525f3e8
[1mdiff --git a/src/app.c b/src/app.c[m [1mindex e22743f5..b7faef55 100644[m [1m--- a/src/app.c[m [1m+++ b/src/app.c[m [36m@@ -2809,7 +2809,7 @@[m [miBool moveFocusWithArrows_App(const void *sdlEvent) {[m : none_Direction);[m if (nextFocus) {[m setCurrent_Window(window_Widget(focus_Widget()));[m [31m- setFocus_Widget(nextFocus);[m [32m+[m[32m setFocusWithMethod_Widget(nextFocus, arrowKeys_FocusMethod);[m return iTrue;[m }[m return focusRoot_Widget(focus_Widget()) != get_Root()->widget;[m [1mdiff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c[m [1mindex a65dc6b3..4975c845 100644[m [1m--- a/src/ui/inputwidget.c[m [1m+++ b/src/ui/inputwidget.c[m [36m@@ -231,6 +231,7 @@[m [menum iInputWidgetFlag {[m dragMarkerStart_InputWidgetFlag = iBit(15),[m dragMarkerEnd_InputWidgetFlag = iBit(16),[m omitDefaultSchemeIfNarrow_InputWidgetFlag = iBit(17),[m [32m+[m[32m arrowFocusNavigable_InputWidgetFlag = iBit(18),[m };[m [m /*----------------------------------------------------------------------------------------------*/[m [36m@@ -864,12 +865,13 @@[m [mvoid init_InputWidget(iInputWidget *d, size_t maxLen) {[m init_String(&d->oldText);[m init_String(&d->srcHint);[m init_String(&d->hint);[m [31m- d->font = uiInput_FontId | alwaysVariableFlag_FontId;[m [31m- d->leftPadding = 0;[m [31m- d->rightPadding = 0;[m [32m+[m[32m d->font = uiInput_FontId | alwaysVariableFlag_FontId;[m [32m+[m[32m d->leftPadding = 0;[m [32m+[m[32m d->rightPadding = 0;[m d->lastUpdateWidth = 0;[m d->inFlags = eatEscape_InputWidgetFlag | enterKeyEnabled_InputWidgetFlag |[m [31m- lineBreaksEnabled_InputWidgetFlag | useReturnKeyBehavior_InputWidgetFlag;[m [32m+[m[32m lineBreaksEnabled_InputWidgetFlag | useReturnKeyBehavior_InputWidgetFlag |[m [32m+[m[32m arrowFocusNavigable_InputWidgetFlag;[m setMaxLen_InputWidget(d, maxLen);[m d->visWrapLines.start = 0;[m d->visWrapLines.end = 1;[m [36m@@ -1080,6 +1082,10 @@[m [mvoid setLineBreaksEnabled_InputWidget(iInputWidget *d, iBool lineBreaksEnabled)[m iChangeFlags(d->inFlags, lineBreaksEnabled_InputWidgetFlag, lineBreaksEnabled);[m }[m [m [32m+[m[32mvoid setArrowFocusNavigable_InputWidget(iInputWidget *d, iBool arrowFocusNavigable) {[m [32m+[m[32m iChangeFlags(d->inFlags, arrowFocusNavigable_InputWidgetFlag, arrowFocusNavigable);[m [32m+[m[32m}[m [32m+[m void setEnterKeyEnabled_InputWidget(iInputWidget *d, iBool enterKeyEnabled) {[m iChangeFlags(d->inFlags, enterKeyEnabled_InputWidgetFlag, enterKeyEnabled);[m }[m [36m@@ -1312,7 +1318,7 @@[m [mvoid systemInputChanged_InputWidget_(iSystemTextInput *sysCtrl, void *widget) {[m }[m #endif[m [m [31m-void begin_InputWidget(iInputWidget *d) {[m [32m+[m[32mstatic void begin_InputWidget_(iInputWidget *d, iBool allowSelectAll) {[m iWidget *w = as_Widget(d);[m if (isEditing_InputWidget_(d)) {[m /* Already active. */[m [36m@@ -1369,7 +1375,7 @@[m [mvoid begin_InputWidget(iInputWidget *d) {[m showCursor_InputWidget_(d);[m refresh_Widget(w);[m startOrStopCursorTimer_InputWidget_(d, iTrue);[m [31m- if (d->inFlags & selectAllOnFocus_InputWidgetFlag) {[m [32m+[m[32m if (allowSelectAll && d->inFlags & selectAllOnFocus_InputWidgetFlag) {[m d->mark = (iRanges){ 0, lastLine_InputWidget_(d)->range.end };[m d->cursor = cursorMax_InputWidget_(d);[m }[m [36m@@ -1382,6 +1388,10 @@[m [mvoid begin_InputWidget(iInputWidget *d) {[m #endif[m }[m [m [32m+[m[32mvoid begin_InputWidget(iInputWidget *d) {[m [32m+[m[32m begin_InputWidget_(d, iTrue);[m [32m+[m[32m}[m [32m+[m void end_InputWidget(iInputWidget *d, iBool accept) {[m iWidget *w = as_Widget(d);[m if (!isEditing_InputWidget_(d)) {[m [36m@@ -2357,7 +2367,8 @@[m [mstatic iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {[m setFocus_Widget(NULL);[m }[m else {[m [31m- begin_InputWidget(d);[m [32m+[m[32m enum iFocusMethod method = arg_Command(command_UserEvent(ev));[m [32m+[m[32m begin_InputWidget_(d, method != arrowKeys_FocusMethod);[m }[m return iFalse;[m }[m [36m@@ -2826,7 +2837,10 @@[m [mstatic iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {[m if (processEvent_Widget(as_Widget(d), ev)) {[m return iTrue;[m }[m [31m- return moveFocusWithArrows_App(ev);[m [32m+[m[32m if (d->inFlags & arrowFocusNavigable_InputWidgetFlag) {[m [32m+[m[32m return moveFocusWithArrows_App(ev);[m [32m+[m[32m }[m [32m+[m[32m return iTrue;[m case SDLK_PAGEUP:[m case SDLK_PAGEDOWN:[m for (int count = 0; count < 5; count++) {[m [1mdiff --git a/src/ui/inputwidget.h b/src/ui/inputwidget.h[m [1mindex a2c5aa1e..f236901d 100644[m [1m--- a/src/ui/inputwidget.h[m [1m+++ b/src/ui/inputwidget.h[m [36m@@ -60,6 +60,7 @@[m [mvoid setContentPadding_InputWidget (iInputWidget *, int left, int right); /[m void setLineLimits_InputWidget (iInputWidget *, int minLines, int maxLines);[m void setValidator_InputWidget (iInputWidget *, iInputWidgetValidatorFunc validator, void *context);[m void setHighlighter_InputWidget (iInputWidget *, iInputWidgetHighlighterFunc highlighter, void *context);[m [32m+[m[32mvoid setArrowFocusNavigable_InputWidget(iInputWidget *, iBool arrowFocusNavigable);[m void setLineBreaksEnabled_InputWidget(iInputWidget *, iBool lineBreaksEnabled);[m void setEnterKeyEnabled_InputWidget (iInputWidget *, iBool enterKeyEnabled);[m void setOmitDefaultSchemeIfNarrow_InputWidget(iInputWidget *, iBool omitDefaultSchemeIfNarrow);[m [1mdiff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c[m [1mindex 8df64a68..d9627119 100644[m [1m--- a/src/ui/sidebarwidget.c[m [1m+++ b/src/ui/sidebarwidget.c[m [36m@@ -2232,7 +2232,7 @@[m [mstatic iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)[m if (isFolder_Bookmark(bm)) {[m contextMenu = d->folderMenu;[m }[m [31m- else if (!isVisible_Widget(d->menu)) { [m [32m+[m[32m else if (!isVisible_Widget(d->menu)) {[m const iBool isRemote = (bm->flags & remote_BookmarkFlag) != 0;[m static const char *localOnlyCmds[] = { "bookmark.edit",[m "bookmark.delete",[m [36m@@ -2429,8 +2429,8 @@[m [mstatic void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,[m iString str;[m init_String(&str);[m appendChar_String(&str, d->icon ? d->icon : 0x1f588);[m [31m- const int leftIndent = d->indent * gap_UI * 4;[m [31m- const iRect iconArea = { addX_I2(pos, gap_UI + leftIndent),[m [32m+[m[32m const int leftIndent = d->indent * gap_UI * 4 * aspect_UI;[m [32m+[m[32m const iRect iconArea = { addX_I2(pos, aspect_UI * gap_UI + leftIndent),[m init_I2(!isTerminal_Platform() ? 1.75f * lineHeight_Text(font) : 5, itemHeight) };[m drawCentered_Text(font,[m iconArea,[m [36m@@ -2444,7 +2444,7 @@[m [mstatic void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,[m const iInt2 textPos = addY_I2(topRight_Rect(iconArea), (itemHeight - lineHeight_Text(font)) / 2);[m drawRange_Text(font, textPos, fg, range_String(&d->label));[m const int metaFont = uiLabel_FontId;[m [31m- const int metaIconWidth = 4.5f * gap_UI;[m [32m+[m[32m const int metaIconWidth = 4.5f * gap_UI * aspect_UI;[m if (isEditing) {[m iRect dragRect = {[m addX_I2(topRight_Rect(itemRect), -itemHeight * 3 / 2),[m [1mdiff --git a/src/ui/uploadwidget.c b/src/ui/uploadwidget.c[m [1mindex 226d3aae..3ee14b7b 100644[m [1m--- a/src/ui/uploadwidget.c[m [1m+++ b/src/ui/uploadwidget.c[m [36m@@ -393,6 +393,9 @@[m [mvoid init_UploadWidget(iUploadWidget *d, enum iUploadProtocol protocol) {[m setFlags_Widget(page, arrangeSize_WidgetFlag, iTrue);[m d->input = new_InputWidget(0);[m setId_Widget(as_Widget(d->input), "upload.text");[m [32m+[m[32m /* It would be annoying for focus to exit the widget accidentally when typing text.[m [32m+[m[32m One needs to use TAB to move focus. */[m [32m+[m[32m setArrowFocusNavigable_InputWidget(d->input, iFalse);[m setFixedSize_Widget(as_Widget(d->input), init_I2(120 * gap_UI * aspectRatio, -1));[m if (prefs_App()->editorSyntaxHighlighting) {[m setHighlighter_InputWidget(d->input, gemtextHighlighter_UploadWidget_, d);[m [1mdiff --git a/src/ui/widget.c b/src/ui/widget.c[m [1mindex 9618b5dc..d1f23a8d 100644[m [1m--- a/src/ui/widget.c[m [1m+++ b/src/ui/widget.c[m [36m@@ -2431,6 +2431,10 @@[m [miBool isAffectedByVisualOffset_Widget(const iWidget *d) {[m }[m [m void setFocus_Widget(iWidget *d) {[m [32m+[m[32m setFocusWithMethod_Widget(d, none_FocusMethod);[m [32m+[m[32m}[m [32m+[m [32m+[m[32mvoid setFocusWithMethod_Widget(iWidget *d, enum iFocusMethod method) {[m iWindow *win = d ? window_Widget(d) : get_Window();[m iAssert(win);[m if (win->focus != d) {[m [36m@@ -2445,7 +2449,12 @@[m [mvoid setFocus_Widget(iWidget *d) {[m win->focus = d;[m if (d) {[m setKeyRoot_Window(get_Window(), d->root);[m [31m- postCommand_Widget(d, "focus.gained");[m [32m+[m[32m if (method) {[m [32m+[m[32m postCommand_Widget(d, "focus.gained arg:%d", method);[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m postCommand_Widget(d, "focus.gained");[m [32m+[m[32m }[m }[m }[m }[m [1mdiff --git a/src/ui/widget.h b/src/ui/widget.h[m [1mindex 28ebe856..100ea7c6 100644[m [1m--- a/src/ui/widget.h[m [1m+++ b/src/ui/widget.h[m [36m@@ -358,8 +358,14 @@[m [mvoid drawScrollIndicator_Widget (const iWidget *, const iWidgetScrollInf[m [m int backgroundFadeColor_Widget (void);[m [m [32m+[m[32menum iFocusMethod {[m [32m+[m[32m none_FocusMethod,[m [32m+[m[32m arrowKeys_FocusMethod,[m [32m+[m[32m};[m [32m+[m const iWidget *focusRoot_Widget (const iWidget *);[m void setFocus_Widget (iWidget *); /* widget must be flagged `focusable` */[m [32m+[m[32mvoid setFocusWithMethod_Widget(iWidget *, enum iFocusMethod method);[m iWidget * focus_Widget (void);[m iBool setHover_Widget (iWidget *);[m iWidget * hover_Widget (void);[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).