summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-06-24 15:45:02 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-06-24 15:45:02 +0300
commitc19b0bbb4cc7d5e373058bd13bec2c9691695b82 (patch)
tree8eb25b97b324ec072cacc63dc4ce198c55cadc8b /src
parent3ca6d5ad281a1006b31f3b7031ecc4693a1b4f89 (diff)
GmDocument: Don't collapse preformatted on Gopher pages
IssueID #300
Diffstat (limited to 'src')
-rw-r--r--src/gmdocument.c9
1 files changed, 8 insertions, 1 deletions
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) {
285 clear_PtrArray(&d->links); 285 clear_PtrArray(&d->links);
286} 286}
287 287
288static iBool isGopher_GmDocument_(const iGmDocument *d) {
289 const iRangecc scheme = urlScheme_String(&d->url);
290 return (equalCase_Rangecc(scheme, "gopher") ||
291 equalCase_Rangecc(scheme, "finger"));
292}
293
288static iBool isForcedMonospace_GmDocument_(const iGmDocument *d) { 294static iBool isForcedMonospace_GmDocument_(const iGmDocument *d) {
289 const iRangecc scheme = urlScheme_String(&d->url); 295 const iRangecc scheme = urlScheme_String(&d->url);
290 if (equalCase_Rangecc(scheme, "gemini")) { 296 if (equalCase_Rangecc(scheme, "gemini")) {
@@ -360,6 +366,7 @@ static void updateOpenURLs_GmDocument_(iGmDocument *d) {
360static void doLayout_GmDocument_(iGmDocument *d) { 366static void doLayout_GmDocument_(iGmDocument *d) {
361 const iPrefs *prefs = prefs_App(); 367 const iPrefs *prefs = prefs_App();
362 const iBool isMono = isForcedMonospace_GmDocument_(d); 368 const iBool isMono = isForcedMonospace_GmDocument_(d);
369 const iBool isGopher = isGopher_GmDocument_(d);
363 const iBool isNarrow = d->size.x < 90 * gap_Text; 370 const iBool isNarrow = d->size.x < 90 * gap_Text;
364 const iBool isVeryNarrow = d->size.x <= 70 * gap_Text; 371 const iBool isVeryNarrow = d->size.x <= 70 * gap_Text;
365 const iBool isExtremelyNarrow = d->size.x <= 60 * gap_Text; 372 const iBool isExtremelyNarrow = d->size.x <= 60 * gap_Text;
@@ -475,7 +482,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
475 meta.flags = constValue_Array(oldPreMeta, preIndex, iGmPreMeta).flags & 482 meta.flags = constValue_Array(oldPreMeta, preIndex, iGmPreMeta).flags &
476 folded_GmPreMetaFlag; 483 folded_GmPreMetaFlag;
477 } 484 }
478 else if (prefs->collapsePreOnLoad) { 485 else if (prefs->collapsePreOnLoad && !isGopher) {
479 meta.flags |= folded_GmPreMetaFlag; 486 meta.flags |= folded_GmPreMetaFlag;
480 } 487 }
481 pushBack_Array(&d->preMeta, &meta); 488 pushBack_Array(&d->preMeta, &meta);