=> f2c1405ceb7b8c2f13b6f74d2e11c66f29106023
[1mdiff --git a/res/about/version.gmi b/res/about/version.gmi[m [1mindex b4434bd2..37323870 100644[m [1m--- a/res/about/version.gmi[m [1m+++ b/res/about/version.gmi[m [36m@@ -6,6 +6,9 @@[m ```[m # Release notes[m [m [32m+[m[32m## 1.16.2[m [32m+[m[32m* Fixed issues with input fields related to handling URLs. Now only the navbar URL field omits the "gemini:" part when the field is narrow, and only when the field is inactive.[m [32m+[m ## 1.16.1[m * Fixed handling of the AltGr key during text input (again).[m * Updated UI translations.[m [1mdiff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c[m [1mindex 108dfec7..897bbc08 100644[m [1m--- a/src/ui/inputwidget.c[m [1m+++ b/src/ui/inputwidget.c[m [36m@@ -223,6 +223,7 @@[m [menum iInputWidgetFlag {[m dragCursor_InputWidgetFlag = iBit(14),[m dragMarkerStart_InputWidgetFlag = iBit(15),[m dragMarkerEnd_InputWidgetFlag = iBit(16),[m [32m+[m[32m omitDefaultSchemeIfNarrow_InputWidgetFlag = iBit(17),[m };[m [m /*----------------------------------------------------------------------------------------------*/[m [36m@@ -998,26 +999,15 @@[m [mvoid setMode_InputWidget(iInputWidget *d, enum iInputMode mode) {[m d->mode = mode;[m }[m [m [31m-static void restoreDefaultScheme_(iString *url) {[m [31m- if (isEmpty_String(url) || startsWith_String(url, "about:") ||[m [31m- startsWith_String(url, "mailto:") || startsWith_String(url, "data:")) {[m [31m- return;[m [31m- }[m [31m- const char *curl = cstr_String(url);[m [31m- if (startsWith_String(url, "//")) {[m [32m+[m[32m/*static void restoreDefaultScheme_(iString *url) {[m [32m+[m[32m if (startsWith_String(url, "//") && size_String(url) > 2) {[m prependCStr_String(url, "gemini:");[m }[m [31m- else if (size_String(url) >= 2 && curl[0] == '/' && curl[1] != '/') {[m [31m- /* This is likely just a path. Don't prepend anything. */[m [31m- }[m [31m- else if (indexOfCStr_String(url, "://") == iInvalidPos) {[m [31m- prependCStr_String(url, "gemini://"); [m [31m- }[m [31m-}[m [32m+[m[32m}*/[m [m static const iString *omitDefaultScheme_(iString *url) {[m if (startsWithCase_String(url, "gemini://")) {[m [31m- remove_Block(&url->chars, 0, 7);[m [32m+[m[32m remove_Block(&url->chars, 0, 7); /* leaving // */[m }[m return url;[m }[m [36m@@ -1026,7 +1016,9 @@[m [mconst iString *text_InputWidget(const iInputWidget *d) {[m iString *text = collect_String(d ? text_InputWidget_(d) : new_String());[m if (d && d->inFlags & isUrl_InputWidgetFlag) {[m /* Add the "gemini" scheme back if one is omitted. */[m [31m- restoreDefaultScheme_(text);[m [32m+[m[32m //restoreDefaultScheme_(text);[m [32m+[m[41m [m [32m+[m[32m /* TODO: Check for `hostname:port` pattern and fit it so it'll be parsed correctly. */[m }[m return text;[m }[m [36m@@ -1079,6 +1071,10 @@[m [mvoid setEnterKeyEnabled_InputWidget(iInputWidget *d, iBool enterKeyEnabled) {[m iChangeFlags(d->inFlags, enterKeyEnabled_InputWidgetFlag, enterKeyEnabled);[m }[m [m [32m+[m[32mvoid setOmitDefaultSchemeIfNarrow_InputWidget(iInputWidget *d, iBool omitDefaultSchemeIfNarrow) {[m [32m+[m[32m iChangeFlags(d->inFlags, omitDefaultSchemeIfNarrow_InputWidgetFlag, omitDefaultSchemeIfNarrow);[m [32m+[m[32m}[m [32m+[m void setUseReturnKeyBehavior_InputWidget(iInputWidget *d, iBool useReturnKeyBehavior) {[m iChangeFlags(d->inFlags, useReturnKeyBehavior_InputWidgetFlag, useReturnKeyBehavior);[m }[m [36m@@ -1113,6 +1109,10 @@[m [mstatic iBool isHintVisible_InputWidget_(const iInputWidget *d) {[m return !isEmpty_String(&d->hint) && isEmpty_InputWidget_(d);[m }[m [m [32m+[m[32mstatic iBool isNarrow_InputWidget_(const iInputWidget *d) {[m [32m+[m[32m return width_Rect(contentBounds_InputWidget_(d)) < 100 * gap_UI * aspect_UI;[m [32m+[m[32m}[m [32m+[m static void updateBuffered_InputWidget_(iInputWidget *d) {[m invalidateBuffered_InputWidget_(d);[m if (isHintVisible_InputWidget_(d)) {[m [36m@@ -1130,6 +1130,9 @@[m [mstatic void updateBuffered_InputWidget_(iInputWidget *d) {[m }[m #endif[m if (d->inFlags & isUrl_InputWidgetFlag) {[m [32m+[m[32m if (d->inFlags & omitDefaultSchemeIfNarrow_InputWidgetFlag && isNarrow_InputWidget_(d)) {[m [32m+[m[32m omitDefaultScheme_(visText);[m [32m+[m[32m }[m /* Highlight the host name. */[m iUrl parts;[m init_Url(&parts, visText);[m [36m@@ -1159,10 +1162,6 @@[m [mvoid setText_InputWidget(iInputWidget *d, const iString *text) {[m setTextUndoable_InputWidget(d, text, iFalse);[m }[m [m [31m-static iBool isNarrow_InputWidget_(const iInputWidget *d) {[m [31m- return width_Rect(contentBounds_InputWidget_(d)) < 100 * gap_UI * aspect_UI;[m [31m-}[m [31m-[m void setTextUndoable_InputWidget(iInputWidget *d, const iString *text, iBool isUndoable) {[m if (!d) return;[m #if !LAGRANGE_USE_SYSTEM_TEXT_INPUT[m [36m@@ -1186,9 +1185,9 @@[m [mvoid setTextUndoable_InputWidget(iInputWidget *d, const iString *text, iBool isU[m text = enc;[m }[m /* Omit the default (Gemini) scheme if there isn't much space. */[m [31m- if (isNarrow_InputWidget_(d)) {[m [32m+[m[32m /*if (isNarrow_InputWidget_(d)) {[m text = omitDefaultScheme_(collect_String(copy_String(text)));[m [31m- }[m [32m+[m[32m }*/[m }[m iString *nfcText = collect_String(copy_String(text));[m normalize_String(nfcText);[m [36m@@ -1307,9 +1306,11 @@[m [mvoid begin_InputWidget(iInputWidget *d) {[m (isAllowedToInsertNewline_InputWidget_(d) ? insertNewlines_SystemTextInputFlag : 0) |[m (d->inFlags & selectAllOnFocus_InputWidgetFlag ? selectAll_SystemTextInputFlags : 0));[m setFont_SystemTextInput(d->sysCtrl, d->font);[m [32m+[m[32m /*[m if (d->inFlags & isUrl_InputWidgetFlag) {[m restoreDefaultScheme_(&d->oldText);[m }[m [32m+[m[32m */[m setText_SystemTextInput(d->sysCtrl, &d->oldText, iFalse);[m setTextChangedFunc_SystemTextInput(d->sysCtrl, systemInputChanged_InputWidget_, d);[m iConnect(Root, w->root, visualOffsetsChanged, d, updateAfterVisualOffsetChange_InputWidget_);[m [36m@@ -1354,9 +1355,10 @@[m [mvoid end_InputWidget(iInputWidget *d, iBool accept) {[m iDisconnect(Root, w->root, visualOffsetsChanged, d, updateAfterVisualOffsetChange_InputWidget_);[m if (accept) {[m set_String(&d->text, text_SystemTextInput(d->sysCtrl));[m [32m+[m[32m /*[m if (d->inFlags & isUrl_InputWidgetFlag && isNarrow_InputWidget_(d)) {[m omitDefaultScheme_(&d->text);[m [31m- }[m [32m+[m[32m }*/[m }[m else {[m set_String(&d->text, &d->oldText);[m [36m@@ -1689,9 +1691,11 @@[m [mstatic iBool copy_InputWidget_(iInputWidget *d, iBool doCut) {[m const iRanges m = mark_InputWidget_(d);[m iString * str = collectNew_String();[m mergeLinesRange_(&d->lines, m, str);[m [32m+[m[32m /*[m if (d->inFlags & isUrl_InputWidgetFlag) {[m restoreDefaultScheme_(str);[m }[m [32m+[m[32m */[m SDL_SetClipboardText([m cstr_String(d->inFlags & isUrl_InputWidgetFlag ? canonicalUrl_String(str) : str));[m if (doCut) {[m [1mdiff --git a/src/ui/inputwidget.h b/src/ui/inputwidget.h[m [1mindex 6840907d..817552ad 100644[m [1m--- a/src/ui/inputwidget.h[m [1m+++ b/src/ui/inputwidget.h[m [36m@@ -54,6 +54,7 @@[m [mvoid setLineLimits_InputWidget (iInputWidget *, int minLines, int maxLi[m void setValidator_InputWidget (iInputWidget *, iInputWidgetValidatorFunc validator, void *context);[m void setLineBreaksEnabled_InputWidget(iInputWidget *, iBool lineBreaksEnabled);[m void setEnterKeyEnabled_InputWidget (iInputWidget *, iBool enterKeyEnabled);[m [32m+[m[32mvoid setOmitDefaultSchemeIfNarrow_InputWidget(iInputWidget *, iBool omitDefaultSchemeIfNarrow);[m void setUseReturnKeyBehavior_InputWidget(iInputWidget *, iBool useReturnKeyBehavior);[m void setBackupFileName_InputWidget (iInputWidget *, const char *fileName);[m void begin_InputWidget (iInputWidget *);[m [1mdiff --git a/src/ui/root.c b/src/ui/root.c[m [1mindex a375f974..cef997f1 100644[m [1m--- a/src/ui/root.c[m [1m+++ b/src/ui/root.c[m [36m@@ -1569,6 +1569,7 @@[m [mvoid createUserInterface_Root(iRoot *d) {[m setLineBreaksEnabled_InputWidget(url, iFalse);[m setUrlContent_InputWidget(url, iTrue);[m setNotifyEdits_InputWidget(url, iTrue);[m [32m+[m[32m setOmitDefaultSchemeIfNarrow_InputWidget(url, iTrue);[m setTextCStr_InputWidget(url, "gemini://");[m addChildFlags_Widget(navBar, iClob(url), 0);[m const int64_t embedFlags =[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).