diff options
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 007311d2..7fddc575 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -421,9 +421,9 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
421 | iGmPreMeta meta = { .bounds = line }; | 421 | iGmPreMeta meta = { .bounds = line }; |
422 | meta.pixelRect.size = measurePreformattedBlock_GmDocument_( | 422 | meta.pixelRect.size = measurePreformattedBlock_GmDocument_( |
423 | d, line.start, preFont, &meta.contents, &meta.bounds.end); | 423 | d, line.start, preFont, &meta.contents, &meta.bounds.end); |
424 | if (meta.pixelRect.size.x > | 424 | if (meta.pixelRect.size.x > d->size.x - indents[preformatted_GmLineType] * gap_Text) { |
425 | d->size.x /*- indents[preformatted_GmLineType] * gap_Text*/) { | ||
426 | preFont = preformattedSmall_FontId; | 425 | preFont = preformattedSmall_FontId; |
426 | meta.pixelRect.size = measureRange_Text(preFont, meta.contents); | ||
427 | } | 427 | } |
428 | trimLine_Rangecc(&line, type, isNormalized); | 428 | trimLine_Rangecc(&line, type, isNormalized); |
429 | meta.altText = line; /* without the ``` */ | 429 | meta.altText = line; /* without the ``` */ |
@@ -1729,4 +1729,14 @@ iInt2 preRunMargin_GmDocument(const iGmDocument *d, uint16_t preId) { | |||
1729 | return init_I2(3 * gap_Text, 2 * gap_Text); | 1729 | return init_I2(3 * gap_Text, 2 * gap_Text); |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | iBool preIsFolded_GmDocument(const iGmDocument *d, uint16_t preId) { | ||
1733 | const iGmPreMeta *meta = preMeta_GmDocument(d, preId); | ||
1734 | return meta && (meta->flags & folded_GmPreMetaFlag) != 0; | ||
1735 | } | ||
1736 | |||
1737 | iBool preHasAltText_GmDocument(const iGmDocument *d, uint16_t preId) { | ||
1738 | const iGmPreMeta *meta = preMeta_GmDocument(d, preId); | ||
1739 | return meta && !isEmpty_Range(&meta->altText); | ||
1740 | } | ||
1741 | |||
1732 | iDefineClass(GmDocument) | 1742 | iDefineClass(GmDocument) |