diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 0fe8220e..599e7ef3 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1042,7 +1042,10 @@ static void documentWasChanged_DocumentWidget_(iDocumentWidget *d) { | |||
1042 | d->flags |= otherRootByDefault_DocumentWidgetFlag; | 1042 | d->flags |= otherRootByDefault_DocumentWidgetFlag; |
1043 | } | 1043 | } |
1044 | } | 1044 | } |
1045 | showOrHidePinningIndicator_DocumentWidget_(d); | 1045 | showOrHidePinningIndicator_DocumentWidget_(d); |
1046 | setCachedDocument_History(d->mod.history, | ||
1047 | d->doc, /* keeps a ref */ | ||
1048 | (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); | ||
1046 | } | 1049 | } |
1047 | 1050 | ||
1048 | void setSource_DocumentWidget(iDocumentWidget *d, const iString *source) { | 1051 | void setSource_DocumentWidget(iDocumentWidget *d, const iString *source) { |
@@ -1168,8 +1171,14 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
1168 | { person_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" } }, | 1171 | { person_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" } }, |
1169 | 2); | 1172 | 2); |
1170 | } | 1173 | } |
1171 | setBanner_GmDocument(d->doc, useBanner ? bannerType_DocumentWidget_(d) : none_GmDocumentBanner); | 1174 | /* Make a new document for the error page.*/ { |
1172 | setFormat_GmDocument(d->doc, gemini_SourceFormat); | 1175 | iGmDocument *errorDoc = new_GmDocument(); |
1176 | setUrl_GmDocument(errorDoc, d->mod.url); | ||
1177 | setBanner_GmDocument(errorDoc, useBanner ? bannerType_DocumentWidget_(d) : none_GmDocumentBanner); | ||
1178 | setFormat_GmDocument(errorDoc, gemini_SourceFormat); | ||
1179 | replaceDocument_DocumentWidget_(d, errorDoc); | ||
1180 | iRelease(errorDoc); | ||
1181 | } | ||
1173 | translate_Lang(src); | 1182 | translate_Lang(src); |
1174 | d->state = ready_RequestState; | 1183 | d->state = ready_RequestState; |
1175 | setSource_DocumentWidget(d, src); | 1184 | setSource_DocumentWidget(d, src); |
@@ -1608,8 +1617,8 @@ static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float n | |||
1608 | format_String(&d->sourceHeader, cstr_Lang("pageinfo.header.cached")); | 1617 | format_String(&d->sourceHeader, cstr_Lang("pageinfo.header.cached")); |
1609 | set_Block(&d->sourceContent, &resp->body); | 1618 | set_Block(&d->sourceContent, &resp->body); |
1610 | updateDocument_DocumentWidget_(d, resp, cachedDoc, iTrue); | 1619 | updateDocument_DocumentWidget_(d, resp, cachedDoc, iTrue); |
1611 | setCachedDocument_History(d->mod.history, d->doc, | 1620 | // setCachedDocument_History(d->mod.history, d->doc, |
1612 | (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); | 1621 | // (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); |
1613 | } | 1622 | } |
1614 | d->state = ready_RequestState; | 1623 | d->state = ready_RequestState; |
1615 | postProcessRequestContent_DocumentWidget_(d, iTrue); | 1624 | postProcessRequestContent_DocumentWidget_(d, iTrue); |
@@ -2705,8 +2714,6 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
2705 | (startsWithCase_String(meta_GmRequest(d->request), "text/") || | 2714 | (startsWithCase_String(meta_GmRequest(d->request), "text/") || |
2706 | !cmp_String(&d->sourceMime, mimeType_Gempub))) { | 2715 | !cmp_String(&d->sourceMime, mimeType_Gempub))) { |
2707 | setCachedResponse_History(d->mod.history, lockResponse_GmRequest(d->request)); | 2716 | setCachedResponse_History(d->mod.history, lockResponse_GmRequest(d->request)); |
2708 | setCachedDocument_History(d->mod.history, d->doc, /* keeps a ref */ | ||
2709 | (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); | ||
2710 | unlockResponse_GmRequest(d->request); | 2717 | unlockResponse_GmRequest(d->request); |
2711 | } | 2718 | } |
2712 | } | 2719 | } |
@@ -4917,7 +4924,7 @@ void setRedirectCount_DocumentWidget(iDocumentWidget *d, int count) { | |||
4917 | 4924 | ||
4918 | void setOpenedFromSidebar_DocumentWidget(iDocumentWidget *d, iBool fromSidebar) { | 4925 | void setOpenedFromSidebar_DocumentWidget(iDocumentWidget *d, iBool fromSidebar) { |
4919 | iChangeFlags(d->flags, openedFromSidebar_DocumentWidgetFlag, fromSidebar); | 4926 | iChangeFlags(d->flags, openedFromSidebar_DocumentWidgetFlag, fromSidebar); |
4920 | setCachedDocument_History(d->mod.history, d->doc, fromSidebar); | 4927 | // setCachedDocument_History(d->mod.history, d->doc, fromSidebar); |
4921 | } | 4928 | } |
4922 | 4929 | ||
4923 | iBool isRequestOngoing_DocumentWidget(const iDocumentWidget *d) { | 4930 | iBool isRequestOngoing_DocumentWidget(const iDocumentWidget *d) { |