diff options
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 4e76a22a..f5ce90a1 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -264,6 +264,17 @@ static void linkContentLaidOut_GmDocument_(iGmDocument *d, const iGmMediaInfo *m | |||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | static iBool isNormalized_GmDocument_(const iGmDocument *d) { | ||
268 | const iPrefs *prefs = prefs_App(); | ||
269 | if (startsWithCase_String(&d->url, "gemini:") && prefs->monospaceGemini) { | ||
270 | return iFalse; | ||
271 | } | ||
272 | if (startsWithCase_String(&d->url, "gopher:") && prefs->monospaceGopher) { | ||
273 | return iFalse; | ||
274 | } | ||
275 | return iTrue; | ||
276 | } | ||
277 | |||
267 | static void doLayout_GmDocument_(iGmDocument *d) { | 278 | static void doLayout_GmDocument_(iGmDocument *d) { |
268 | const iBool isMono = isForcedMonospace_GmDocument_(d); | 279 | const iBool isMono = isForcedMonospace_GmDocument_(d); |
269 | /* TODO: Collect these parameters into a GmTheme. */ | 280 | /* TODO: Collect these parameters into a GmTheme. */ |
@@ -324,6 +335,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
324 | uint16_t preId = 0; | 335 | uint16_t preId = 0; |
325 | iBool enableIndents = iFalse; | 336 | iBool enableIndents = iFalse; |
326 | iBool addSiteBanner = d->bannerType != none_GmDocumentBanner; | 337 | iBool addSiteBanner = d->bannerType != none_GmDocumentBanner; |
338 | const iBool isNormalized = isNormalized_GmDocument_(d); | ||
327 | enum iGmLineType prevType = text_GmLineType; | 339 | enum iGmLineType prevType = text_GmLineType; |
328 | if (d->format == plainText_GmDocumentFormat) { | 340 | if (d->format == plainText_GmDocumentFormat) { |
329 | isPreformat = iTrue; | 341 | isPreformat = iTrue; |
@@ -363,7 +375,9 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
363 | type = text_GmLineType; | 375 | type = text_GmLineType; |
364 | } | 376 | } |
365 | } | 377 | } |
366 | trimLine_Rangecc_(&line, type); | 378 | if (isNormalized) { |
379 | trimLine_Rangecc_(&line, type); | ||
380 | } | ||
367 | run.font = fonts[type]; | 381 | run.font = fonts[type]; |
368 | /* Remember headings for the document outline. */ | 382 | /* Remember headings for the document outline. */ |
369 | if (type == heading1_GmLineType || type == heading2_GmLineType || type == heading3_GmLineType) { | 383 | if (type == heading1_GmLineType || type == heading2_GmLineType || type == heading3_GmLineType) { |
@@ -1219,7 +1233,9 @@ void setUrl_GmDocument(iGmDocument *d, const iString *url) { | |||
1219 | 1233 | ||
1220 | void setSource_GmDocument(iGmDocument *d, const iString *source, int width) { | 1234 | void setSource_GmDocument(iGmDocument *d, const iString *source, int width) { |
1221 | set_String(&d->source, source); | 1235 | set_String(&d->source, source); |
1222 | normalize_GmDocument(d); | 1236 | if (isNormalized_GmDocument_(d)) { |
1237 | normalize_GmDocument(d); | ||
1238 | } | ||
1223 | setWidth_GmDocument(d, width); /* re-do layout */ | 1239 | setWidth_GmDocument(d, width); /* re-do layout */ |
1224 | } | 1240 | } |
1225 | 1241 | ||