From fb38f92c3a5c29c568575df87f0c29e777ebd969 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 29 Mar 2021 11:05:09 +0300 Subject: Improving alt text animation; cleaned up key shortcut labels Remove extra Plus signs from key shortcuts. --- src/gmdocument.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gmdocument.c') 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) { iGmPreMeta meta = { .bounds = line }; meta.pixelRect.size = measurePreformattedBlock_GmDocument_( d, line.start, preFont, &meta.contents, &meta.bounds.end); - if (meta.pixelRect.size.x > - d->size.x /*- indents[preformatted_GmLineType] * gap_Text*/) { + if (meta.pixelRect.size.x > d->size.x - indents[preformatted_GmLineType] * gap_Text) { preFont = preformattedSmall_FontId; + meta.pixelRect.size = measureRange_Text(preFont, meta.contents); } trimLine_Rangecc(&line, type, isNormalized); meta.altText = line; /* without the ``` */ @@ -1729,4 +1729,14 @@ iInt2 preRunMargin_GmDocument(const iGmDocument *d, uint16_t preId) { return init_I2(3 * gap_Text, 2 * gap_Text); } +iBool preIsFolded_GmDocument(const iGmDocument *d, uint16_t preId) { + const iGmPreMeta *meta = preMeta_GmDocument(d, preId); + return meta && (meta->flags & folded_GmPreMetaFlag) != 0; +} + +iBool preHasAltText_GmDocument(const iGmDocument *d, uint16_t preId) { + const iGmPreMeta *meta = preMeta_GmDocument(d, preId); + return meta && !isEmpty_Range(&meta->altText); +} + iDefineClass(GmDocument) -- cgit v1.2.3