Lagrange [work/v1.15]

Gopher: Added option to disable all Gemini styling

=> 158eee2afd7ce99aeb254a3661f03a2832007cae

diff --git a/po/en.po b/po/en.po
index c4e80bf5..37dfffed 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1816,6 +1816,9 @@ msgstr "Gemini"
 msgid "prefs.mono.gopher"
 msgstr "Gopher"
 
+msgid "prefs.gopher.gemstyle"
+msgstr "Styling on Gopher:"
+
 msgid "prefs.boldlink"
 msgstr "Bold links:"
 
diff --git a/res/about/version.gmi b/res/about/version.gmi
index 62f3aa5f..1c4d99fb 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -9,6 +9,7 @@
 ## 1.15
 New features:
 * Indicate that tab autoreloading is enabled by changing the appearance of the navbar reload button.
+* Gopher: Option to disable Gemini styling on Gopher menu pages. When disabled, whitespace is not normalized and all non-link lines are presented as regular paragraph text.
 
 Changes and enhancements:
 * GTK: Request dark window theme if the app UI color theme is dark.
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index 0b4ac955..4e802ba7 100644
Binary files a/res/lang/cs.bin and b/res/lang/cs.bin differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 3c6b772e..31715f3e 100644
Binary files a/res/lang/de.bin and b/res/lang/de.bin differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index 53951b46..2e2f9522 100644
Binary files a/res/lang/en.bin and b/res/lang/en.bin differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index 529cb4e4..59151ad9 100644
Binary files a/res/lang/eo.bin and b/res/lang/eo.bin differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index 504aa14c..000b46f7 100644
Binary files a/res/lang/es.bin and b/res/lang/es.bin differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index 4646466a..ed686023 100644
Binary files a/res/lang/es_MX.bin and b/res/lang/es_MX.bin differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index ba2c97d1..5966054d 100644
Binary files a/res/lang/fi.bin and b/res/lang/fi.bin differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 6b350800..4759de0d 100644
Binary files a/res/lang/fr.bin and b/res/lang/fr.bin differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 861f36fa..2eda23ee 100644
Binary files a/res/lang/gl.bin and b/res/lang/gl.bin differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index ad8b55f3..81d49de8 100644
Binary files a/res/lang/hu.bin and b/res/lang/hu.bin differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index 3a060ef5..dd963eca 100644
Binary files a/res/lang/ia.bin and b/res/lang/ia.bin differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index 798d8f93..6a79a05b 100644
Binary files a/res/lang/ie.bin and b/res/lang/ie.bin differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index 8c1c24cc..d484ea8f 100644
Binary files a/res/lang/isv.bin and b/res/lang/isv.bin differ
diff --git a/res/lang/it.bin b/res/lang/it.bin
index d144981b..1d907cfa 100644
Binary files a/res/lang/it.bin and b/res/lang/it.bin differ
diff --git a/res/lang/nl.bin b/res/lang/nl.bin
index 812c0cd1..8c3c7d74 100644
Binary files a/res/lang/nl.bin and b/res/lang/nl.bin differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index 8552ee60..e309f76e 100644
Binary files a/res/lang/pl.bin and b/res/lang/pl.bin differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index a98ed7ce..1ac217bd 100644
Binary files a/res/lang/ru.bin and b/res/lang/ru.bin differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index 8ef84fea..5ecef86c 100644
Binary files a/res/lang/sk.bin and b/res/lang/sk.bin differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 760c0324..4e70b7b4 100644
Binary files a/res/lang/sr.bin and b/res/lang/sr.bin differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 1987fc98..65cac0c0 100644
Binary files a/res/lang/tok.bin and b/res/lang/tok.bin differ
diff --git a/res/lang/tr.bin b/res/lang/tr.bin
index 53fc0b1b..42704ae2 100644
Binary files a/res/lang/tr.bin and b/res/lang/tr.bin differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index cc21113e..dd0c6a55 100644
Binary files a/res/lang/uk.bin and b/res/lang/uk.bin differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index 8f8804b2..84cfdb8b 100644
Binary files a/res/lang/zh_Hans.bin and b/res/lang/zh_Hans.bin differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 4511701b..11baf6a0 100644
Binary files a/res/lang/zh_Hant.bin and b/res/lang/zh_Hant.bin differ
diff --git a/src/app.c b/src/app.c
index 9697a7c5..564cd9b6 100644
--- a/src/app.c
+++ b/src/app.c
@@ -329,6 +329,7 @@ static iString *serializePrefs_App_(const iApp *d) {
         { "prefs.dataurl.openimages", &d->prefs.openDataUrlImagesOnLoad },
         { "prefs.font.smooth", &d->prefs.fontSmoothing },
         { "prefs.font.warnmissing", &d->prefs.warnAboutMissingGlyphs },
+        { "prefs.gopher.gemstyle", &d->prefs.geminiStyledGopher },
         { "prefs.hoverlink", &d->prefs.hoverLink },
         { "prefs.justify", &d->prefs.justifyParagraph },
         { "prefs.markdown.viewsource", &d->prefs.markdownAsSource },
@@ -3144,6 +3145,10 @@ static iBool handleNonWindowRelatedCommand_App_(iApp *d, const char *cmd) {
         d->prefs.markdownAsSource = arg_Command(cmd) != 0;
         return iTrue;
     }
+    else if (equal_Command(cmd, "prefs.gopher.gemstyle.changed")) {
+        d->prefs.geminiStyledGopher = arg_Command(cmd) != 0;
+        return iTrue;
+    }
     else if (equal_Command(cmd, "prefs.mono.gemini.changed") ||
              equal_Command(cmd, "prefs.mono.gopher.changed")) {
         const iBool isSet = (arg_Command(cmd) != 0);
@@ -4115,6 +4120,7 @@ iBool handleCommand_App(const char *cmd) {
         setToggle_Widget(findChild_Widget(dlg, "prefs.evensplit"), d->prefs.evenSplit);
         setToggle_Widget(findChild_Widget(dlg, "prefs.swipe.edge"), d->prefs.edgeSwipe);
         setToggle_Widget(findChild_Widget(dlg, "prefs.swipe.page"), d->prefs.pageSwipe);
+        setToggle_Widget(findChild_Widget(dlg, "prefs.gopher.gemstyle"), d->prefs.geminiStyledGopher);
         updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit);
         updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]);
         updateScrollSpeedButtons_(dlg, keyboard_ScrollType, d->prefs.smoothScrollSpeed[keyboard_ScrollType]);
diff --git a/src/gmdocument.c b/src/gmdocument.c
index af559701..d165ac26 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -191,8 +191,7 @@ static iBool isForcedMonospace_GmDocument_(const iGmDocument *d) {
     if (equalCase_Rangecc(scheme, "gemini")) {
         return prefs_App()->monospaceGemini;
     }
-    if (equalCase_Rangecc(scheme, "gopher") ||
-        equalCase_Rangecc(scheme, "finger")) {
+    if (equalCase_Rangecc(scheme, "gopher") || equalCase_Rangecc(scheme, "finger")) {
         return prefs_App()->monospaceGopher;
     }
     return iFalse;
@@ -526,7 +525,8 @@ static iBool shouldBeNormalized_GmDocument_(const iGmDocument *d) {
     if (startsWithCase_String(&d->url, "gemini:") && prefs->monospaceGemini) {
         return iFalse;
     }
-    if (startsWithCase_String(&d->url, "gopher:") && prefs->monospaceGopher) {
+    if (startsWithCase_String(&d->url, "gopher:") && (prefs->monospaceGopher ||
+                                                      !prefs->geminiStyledGopher)) {
         return iFalse;
     }
     return iTrue;
@@ -744,6 +744,9 @@ static void doLayout_GmDocument_(iGmDocument *d) {
     enum iGmLineType prevType      = text_GmLineType;
     enum iGmLineType prevNonBlankType = text_GmLineType;
     iBool            followsBlank  = iFalse;
+    if (isGopher && !prefs->geminiStyledGopher) {
+        isFirstText = iFalse;
+    }
     if (d->format == plainText_SourceFormat) {
         isPreformat = iTrue;
         isFirstText = iFalse;
@@ -2649,21 +2652,6 @@ enum iColorId linkColor_GmDocument(const iGmDocument *d, iGmLinkId linkId, enum
                    : isOldSchool_GmLinkScheme(scheme) ? tmGopherLinkTextHover_ColorId
                                                       : tmLinkTextHover_ColorId;
         }
-        /*
-        if (part == domain_GmLinkPart) {
-            if (isUnsupported) {
-                return tmBadLink_ColorId;
-            }
-            return isWWW_GmLinkScheme(scheme)         ? tmHypertextLinkDomain_ColorId
-                   : isOldSchool_GmLinkScheme(scheme) ? tmGopherLinkDomain_ColorId
-                                                      : tmLinkDomain_ColorId;
-        }
-        if (part == visited_GmLinkPart) {
-            return isWWW_GmLinkScheme(scheme)         ? tmHypertextLinkLastVisitDate_ColorId
-                   : isOldSchool_GmLinkScheme(scheme) ? tmGopherLinkLastVisitDate_ColorId
-                                                      : tmLinkLastVisitDate_ColorId;
-        }
-        */
     }
     return tmLinkText_ColorId;
 }
diff --git a/src/gopher.c b/src/gopher.c
index 0e34fe6a..0be885bf 100644
--- a/src/gopher.c
+++ b/src/gopher.c
@@ -21,6 +21,8 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
 
 #include "gopher.h"
+#include "prefs.h"
+#include "app.h"
 
 #include 
 
@@ -47,6 +49,9 @@ static iBool isPreformatted_(iRangecc text) {
     int  numSpace  = 0;
     int  numRepeat = 0;
     char chPrev    = 0;
+    if (!prefs_App()->geminiStyledGopher) {
+        return iFalse; /* just regular text */
+    }
     for (const char *ch = text.start; ch != text.end; ch++) {
         if (*ch < 0) {
             iChar uc;
diff --git a/src/prefs.c b/src/prefs.c
index 5d4858bf..3c725908 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -116,6 +116,7 @@ void init_Prefs(iPrefs *d) {
     d->quoteIcon         = iTrue;
     d->centerShortDocs   = iTrue;
     d->plainTextWrap     = iTrue;
+    d->geminiStyledGopher = iTrue;
     d->imageStyle        = original_ImageStyle;
     d->docThemeDark      = colorfulDark_GmDocumentTheme;
     d->docThemeLight     = white_GmDocumentTheme;
diff --git a/src/prefs.h b/src/prefs.h
index 04e9ad4f..17c37408 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -111,6 +111,7 @@ enum iPrefsBool {
     centerShortDocs_PrefsBool,
     
     plainTextWrap_PrefsBool,
+    geminiStyledGopher_PrefsBool,
     
     /* Meta */
     max_PrefsBool
@@ -179,6 +180,7 @@ struct Impl_Prefs {
             iBool centerShortDocs;
             
             iBool plainTextWrap;
+            iBool geminiStyledGopher;
         };
     };
     /* UI state (belongs to state.lgr...) */
diff --git a/src/ui/util.c b/src/ui/util.c
index 7d7aaaaf..56300a66 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2899,8 +2899,9 @@ iWidget *makePreferences_Widget(void) {
             { "radio horizontal:1 id:prefs.linewidth", 0, 0, (const void *) lineWidthItems },
             { "padding" },
             { "toggle id:prefs.justify" },
-            { "toggle id:prefs.plaintext.wrap" },
             { "toggle id:prefs.biglede" },
+            { "toggle id:prefs.plaintext.wrap" },
+            { "toggle id:prefs.gopher.gemstyle" },
             { "padding" },
             { "input id:prefs.linespacing maxlen:5" },
             { "input id:prefs.tabwidth maxlen:3" },
@@ -3243,8 +3244,9 @@ iWidget *makePreferences_Widget(void) {
 #if defined (LAGRANGE_ENABLE_HARFBUZZ)
         addDialogToggle_(headings, values, "${prefs.justify}", "prefs.justify");
 #endif
-        addDialogToggle_(headings, values, "${prefs.plaintext.wrap}", "prefs.plaintext.wrap");
         addDialogToggle_(headings, values, "${prefs.biglede}", "prefs.biglede");
+        addDialogToggle_(headings, values, "${prefs.plaintext.wrap}", "prefs.plaintext.wrap");
+        addDialogToggle_(headings, values, "${prefs.gopher.gemstyle}", "prefs.gopher.gemstyle");
         addDialogPadding_(headings, values);
         addPrefsInputWithHeading_(headings, values, "prefs.tabwidth", iClob(new_InputWidget(5)));
         addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.quoteicon}")));
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.15/cdiff/158eee2afd7ce99aeb254a3661f03a2832007cae
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
34.99212 milliseconds
Gemini-to-HTML Time
0.47604 milliseconds

This content has been proxied by September (3851b).