summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-11-03 07:09:16 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-11-03 07:09:16 +0200
commitf4172885428f9849ff29bd09490db8b167a8d705 (patch)
treec82af9c46bce0f56627e61d180a630e11fb8baee /src/ui
parent20b5a9bbad524e242b7ade9fdcd06f34721c5f3a (diff)
Redo cached document layout if needed
Changing the fonts, zoom level, or window width will cause cached documents to be laid out again if they are restored from memory.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 79bfea7b..8c24d4a9 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1702,6 +1702,7 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
1702 } 1702 }
1703 if (cachedDoc) { 1703 if (cachedDoc) {
1704 replaceDocument_DocumentWidget_(d, cachedDoc); 1704 replaceDocument_DocumentWidget_(d, cachedDoc);
1705 updateWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d), width_Widget(d));
1705 } 1706 }
1706 else if (setSource) { 1707 else if (setSource) {
1707 setSource_DocumentWidget(d, &str); 1708 setSource_DocumentWidget(d, &str);
@@ -2498,7 +2499,7 @@ static iBool updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocumen
2498 /* TODO: First *fully* visible run? */ 2499 /* TODO: First *fully* visible run? */
2499 voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds); 2500 voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds);
2500 } 2501 }
2501 setWidth_GmDocument(d->doc, newWidth, (width_Widget(d) - newWidth) / 2); 2502 setWidth_GmDocument(d->doc, newWidth, width_Widget(d));
2502 setWidth_Banner(d->banner, newWidth); 2503 setWidth_Banner(d->banner, newWidth);
2503 documentRunsInvalidated_DocumentWidget_(d); 2504 documentRunsInvalidated_DocumentWidget_(d);
2504 if (runLoc && !keepCenter) { 2505 if (runLoc && !keepCenter) {
@@ -2734,6 +2735,9 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2734 } 2735 }
2735 else if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed") || 2736 else if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed") ||
2736 equal_Command(cmd, "keyroot.changed")) { 2737 equal_Command(cmd, "keyroot.changed")) {
2738 if (equal_Command(cmd, "font.changed")) {
2739 invalidateCachedLayout_History(d->mod.history);
2740 }
2737 /* Alt/Option key may be involved in window size changes. */ 2741 /* Alt/Option key may be involved in window size changes. */
2738 setLinkNumberMode_DocumentWidget_(d, iFalse); 2742 setLinkNumberMode_DocumentWidget_(d, iFalse);
2739 d->phoneToolbar = findWidget_App("toolbar"); 2743 d->phoneToolbar = findWidget_App("toolbar");