summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-03 21:07:04 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-03 21:07:04 +0300
commit779745c6d8d36e91d2b0f39bc94c78ef265464d0 (patch)
treeb2dd6177cf374584c8193411cb8c6581dd11de5c /src
parentf7e087c453aecbe102b026c067c8a083f82a0318 (diff)
GmDocument: Normalizing plain text
Plain text should always go through normalization so tabs are replaced with a known number of spaces. The text renderer uses \t for column alignment.
Diffstat (limited to 'src')
-rw-r--r--src/gmdocument.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 378926e7..8361e77b 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -294,6 +294,9 @@ static void linkContentWasLaidOut_GmDocument_(iGmDocument *d, const iGmMediaInfo
294 294
295static iBool isNormalized_GmDocument_(const iGmDocument *d) { 295static iBool isNormalized_GmDocument_(const iGmDocument *d) {
296 const iPrefs *prefs = prefs_App(); 296 const iPrefs *prefs = prefs_App();
297 if (d->format == plainText_GmDocumentFormat) {
298 return iTrue; /* tabs are always normalized in plain text */
299 }
297 if (startsWithCase_String(&d->url, "gemini:") && prefs->monospaceGemini) { 300 if (startsWithCase_String(&d->url, "gemini:") && prefs->monospaceGemini) {
298 return iFalse; 301 return iFalse;
299 } 302 }
@@ -1380,7 +1383,8 @@ static void normalize_GmDocument(iGmDocument *d) {
1380 } 1383 }
1381 } 1384 }
1382 appendCStr_String(normalized, "\n"); 1385 appendCStr_String(normalized, "\n");
1383 if (lineType_GmDocument_(d, line) == preformatted_GmLineType) { 1386 if (d->format == gemini_GmDocumentFormat &&
1387 lineType_GmDocument_(d, line) == preformatted_GmLineType) {
1384 isPreformat = iFalse; 1388 isPreformat = iFalse;
1385 } 1389 }
1386 continue; 1390 continue;