From c19b0bbb4cc7d5e373058bd13bec2c9691695b82 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 24 Jun 2021 15:45:02 +0300 Subject: GmDocument: Don't collapse preformatted on Gopher pages IssueID #300 --- src/gmdocument.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/gmdocument.c') diff --git a/src/gmdocument.c b/src/gmdocument.c index 4f9f97e7..cde714e7 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c @@ -285,6 +285,12 @@ static void clearLinks_GmDocument_(iGmDocument *d) { clear_PtrArray(&d->links); } +static iBool isGopher_GmDocument_(const iGmDocument *d) { + const iRangecc scheme = urlScheme_String(&d->url); + return (equalCase_Rangecc(scheme, "gopher") || + equalCase_Rangecc(scheme, "finger")); +} + static iBool isForcedMonospace_GmDocument_(const iGmDocument *d) { const iRangecc scheme = urlScheme_String(&d->url); if (equalCase_Rangecc(scheme, "gemini")) { @@ -360,6 +366,7 @@ static void updateOpenURLs_GmDocument_(iGmDocument *d) { static void doLayout_GmDocument_(iGmDocument *d) { const iPrefs *prefs = prefs_App(); const iBool isMono = isForcedMonospace_GmDocument_(d); + const iBool isGopher = isGopher_GmDocument_(d); const iBool isNarrow = d->size.x < 90 * gap_Text; const iBool isVeryNarrow = d->size.x <= 70 * gap_Text; const iBool isExtremelyNarrow = d->size.x <= 60 * gap_Text; @@ -475,7 +482,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { meta.flags = constValue_Array(oldPreMeta, preIndex, iGmPreMeta).flags & folded_GmPreMetaFlag; } - else if (prefs->collapsePreOnLoad) { + else if (prefs->collapsePreOnLoad && !isGopher) { meta.flags |= folded_GmPreMetaFlag; } pushBack_Array(&d->preMeta, &meta); -- cgit v1.2.3