summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 17c44105..f8e5b8ad 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -602,11 +602,13 @@ static void doLayout_GmDocument_(iGmDocument *d) {
602 } 602 }
603 rightMargin = (type == text_GmLineType || type == bullet_GmLineType || 603 rightMargin = (type == text_GmLineType || type == bullet_GmLineType ||
604 type == quote_GmLineType ? 4 : 0); 604 type == quote_GmLineType ? 4 : 0);
605 const iBool isWordWrapped =
606 (d->format == plainText_GmDocumentFormat ? prefs->plainTextWrap : !isPreformat);
605 iAssert(!isEmpty_Range(&runLine)); /* must have something at this point */ 607 iAssert(!isEmpty_Range(&runLine)); /* must have something at this point */
606 while (!isEmpty_Range(&runLine)) { 608 while (!isEmpty_Range(&runLine)) {
607 run.bounds.pos = addX_I2(pos, indent * gap_Text); 609 run.bounds.pos = addX_I2(pos, indent * gap_Text);
610 const int avail = isWordWrapped ? d->size.x - run.bounds.pos.x - rightMargin * gap_Text : 0;
608 const char *contPos; 611 const char *contPos;
609 const int avail = isPreformat ? 0 : (d->size.x - run.bounds.pos.x - rightMargin * gap_Text);
610 const iInt2 dims = tryAdvance_Text(run.font, runLine, avail, &contPos); 612 const iInt2 dims = tryAdvance_Text(run.font, runLine, avail, &contPos);
611 iChangeFlags(run.flags, wide_GmRunFlag, (isPreformat && dims.x > d->size.x)); 613 iChangeFlags(run.flags, wide_GmRunFlag, (isPreformat && dims.x > d->size.x));
612 run.bounds.size.x = iMax(avail, dims.x); /* Extends to the right edge for selection. */ 614 run.bounds.size.x = iMax(avail, dims.x); /* Extends to the right edge for selection. */