From 779745c6d8d36e91d2b0f39bc94c78ef265464d0 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 3 Apr 2021 21:07:04 +0300 Subject: 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. --- src/gmdocument.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 static iBool isNormalized_GmDocument_(const iGmDocument *d) { const iPrefs *prefs = prefs_App(); + if (d->format == plainText_GmDocumentFormat) { + return iTrue; /* tabs are always normalized in plain text */ + } if (startsWithCase_String(&d->url, "gemini:") && prefs->monospaceGemini) { return iFalse; } @@ -1380,7 +1383,8 @@ static void normalize_GmDocument(iGmDocument *d) { } } appendCStr_String(normalized, "\n"); - if (lineType_GmDocument_(d, line) == preformatted_GmLineType) { + if (d->format == gemini_GmDocumentFormat && + lineType_GmDocument_(d, line) == preformatted_GmLineType) { isPreformat = iFalse; } continue; -- cgit v1.2.3