=> cc798c0f7ca53cc0f14a29439049309ae20616a8
[1mdiff --git a/src/gmdocument.c b/src/gmdocument.c[m [1mindex bec89ca0..29e97300 100644[m [1m--- a/src/gmdocument.c[m [1m+++ b/src/gmdocument.c[m [36m@@ -37,6 +37,7 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m #include[m #include [m #include [m [32m+[m[32m#include [m #include [m [m #include [m [36m@@ -163,6 +164,7 @@[m [mstruct Impl_GmDocument {[m iBool enableCommandLinks; /* `about:command?` only allowed on selected pages */[m iBool isLayoutInvalidated;[m iArray layout; /* contents of source, laid out in document space */[m [32m+[m[32m iStringArray auxText; /* generated text that appears on the page but is not part of the source */[m iPtrArray links;[m iString title; /* the first top-level title */[m iArray headings;[m [36m@@ -638,6 +640,7 @@[m [mstatic void doLayout_GmDocument_(iGmDocument *d) {[m static const char *uploadArrow = upload_Icon;[m static const char *image = photo_Icon;[m clear_Array(&d->layout);[m [32m+[m[32m clear_StringArray(&d->auxText);[m clearLinks_GmDocument_(d);[m clear_Array(&d->headings);[m const iArray *oldPreMeta = collect_Array(copy_Array(&d->preMeta)); /* remember fold states */[m [36m@@ -1070,7 +1073,9 @@[m [mstatic void doLayout_GmDocument_(iGmDocument *d) {[m run.bounds.pos.x -= d->outsideMargin;[m }[m run.visBounds = run.bounds;[m [31m- const iInt2 maxSize = mulf_I2(imgSize, get_Window()->pixelRatio);[m [32m+[m[32m const iInt2 maxSize = mulf_I2([m [32m+[m[32m imgSize,[m [32m+[m[32m get_Window()->pixelRatio * iMax(1.0f, (prefs_App()->zoomPercent / 100.0f)));[m if (width_Rect(run.visBounds) > maxSize.x) {[m /* Don't scale the image up. */[m run.visBounds.size.y =[m [36m@@ -1080,6 +1085,34 @@[m [mstatic void doLayout_GmDocument_(iGmDocument *d) {[m run.bounds.size.y = run.visBounds.size.y;[m }[m pushBack_Array(&d->layout, &run);[m [32m+[m[32m pos.y += run.bounds.size.y + margin / 2;[m [32m+[m[32m /* Image metadata caption. */ {[m [32m+[m[32m run.font = FONT_ID(documentBody_FontId, semiBold_FontStyle, contentSmall_FontSize);[m [32m+[m[32m run.color = tmQuoteIcon_ColorId;[m [32m+[m[32m run.flags = decoration_GmRunFlag;[m [32m+[m[32m run.mediaId = 0;[m [32m+[m[32m run.mediaType = 0;[m [32m+[m[32m run.visBounds.pos.y = pos.y;[m [32m+[m[32m run.visBounds.size.y = lineHeight_Text(run.font);[m [32m+[m[32m run.bounds = zero_Rect();[m [32m+[m[32m iString caption;[m [32m+[m[32m init_String(&caption);[m [32m+[m[32m format_String(&caption,[m [32m+[m[32m "%s \u2014 %d x %d \u2014 %.1f%s",[m [32m+[m[32m info.type,[m [32m+[m[32m imgSize.x,[m [32m+[m[32m imgSize.y,[m [32m+[m[32m info.numBytes / 1.0e6f,[m [32m+[m[32m cstr_Lang("mb"));[m [32m+[m[32m pushBack_StringArray(&d->auxText, &caption);[m [32m+[m[32m run.text = range_String(&caption);[m [32m+[m[32m /* Center it. */[m [32m+[m[32m run.visBounds.size.x = measureRange_Text(run.font, range_String(&caption)).bounds.size.x;[m [32m+[m[32m run.visBounds.pos.x = d->size.x / 2 - run.visBounds.size.x / 2;[m [32m+[m[32m deinit_String(&caption);[m [32m+[m[32m pushBack_Array(&d->layout, &run);[m [32m+[m[32m pos.y += run.visBounds.size.y + margin;[m [32m+[m[32m }[m break;[m }[m case audio_MediaType: {[m [36m@@ -1152,6 +1185,7 @@[m [mvoid init_GmDocument(iGmDocument *d) {[m d->enableCommandLinks = iFalse;[m d->isLayoutInvalidated = iFalse;[m init_Array(&d->layout, sizeof(iGmRun));[m [32m+[m[32m init_StringArray(&d->auxText);[m init_PtrArray(&d->links);[m init_String(&d->title);[m init_Array(&d->headings, sizeof(iGmHeading));[m [36m@@ -1173,6 +1207,7 @@[m [mvoid deinit_GmDocument(iGmDocument *d) {[m deinit_PtrArray(&d->links);[m deinit_Array(&d->preMeta);[m deinit_Array(&d->headings);[m [32m+[m[32m deinit_StringArray(&d->auxText);[m deinit_Array(&d->layout);[m deinit_String(&d->localHost);[m deinit_String(&d->url);[m [1mdiff --git a/src/gmdocument.h b/src/gmdocument.h[m [1mindex 58fc3db3..eb02a26c 100644[m [1m--- a/src/gmdocument.h[m [1m+++ b/src/gmdocument.h[m [36m@@ -139,7 +139,7 @@[m [mstruct Impl_GmRun {[m [m uint32_t font : 14;[m uint32_t mediaType : 3; /* note: max_MediaType means preformatted block */[m [31m- uint32_t mediaId : 11; /* zero if not an image */[m [32m+[m[32m uint32_t mediaId : 11;[m uint32_t lineType : 3;[m uint32_t isLede : 1;[m };[m [1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex 1449d10d..06e3475a 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -1529,7 +1529,7 @@[m [mstatic void postProcessRequestContent_DocumentWidget_(iDocumentWidget *d, iBool[m }[m else {[m postCommandf_App([m [31m- "open newtab:%d url:%s", otherRoot_OpenTabFlag, cstr_String(navStart));[m [32m+[m[32m "open splitmode:1 newtab:%d url:%s", otherRoot_OpenTabFlag, cstr_String(navStart));[m }[m }[m }[m [36m@@ -4753,9 +4753,9 @@[m [mstatic void drawRun_DrawContext_(void *context, const iGmRun *run) {[m /* Open links get a highlighted background. */[m int bg = tmBackgroundOpenLink_ColorId;[m const int frame = tmFrameOpenLink_ColorId;[m [31m- iRect wideRect = { init_I2(left_Rect(d->widgetBounds), visPos.y),[m [31m- init_I2(width_Rect(d->widgetBounds) +[m [31m- width_Widget(d->widget->scroll),[m [32m+[m[32m const int pad = gap_Text;[m [32m+[m[32m iRect wideRect = { init_I2(d->docBounds.pos.x - pad, visPos.y),[m [32m+[m[32m init_I2(d->docBounds.size.x + 2 * pad,[m height_Rect(run->visBounds)) };[m /* The first line is composed of two runs that may be drawn in either order, so[m only draw half of the background. */[m [36m@@ -4767,14 +4767,6 @@[m [mstatic void drawRun_DrawContext_(void *context, const iGmRun *run) {[m wideRect.pos.x = left_Rect(visRect);[m }[m fillRect_Paint(&d->paint, wideRect, bg);[m [31m- if (run->flags & (startOfLine_GmRunFlag | decoration_GmRunFlag)) {[m [31m- drawHLine_Paint(&d->paint, topLeft_Rect(wideRect), width_Rect(wideRect), frame);[m [31m- }[m [31m- /* TODO: The decoration is not marked as endOfLine, so it lacks the bottom line. */[m [31m-// if (run->flags & endOfLine_GmRunFlag) {[m [31m-// drawHLine_Paint([m [31m-// &d->paint, addY_I2(bottomLeft_Rect(wideRect), -1), width_Rect(wideRect), frame);[m [31m-// }[m }[m else { [m /* Normal background for other runs. There are cases when runs get drawn multiple times,[m [36m@@ -4866,11 +4858,7 @@[m [mstatic void drawRun_DrawContext_(void *context, const iGmRun *run) {[m info_Media(constMedia_GmDocument(doc), linkMedia, &info);[m switch (linkMedia.type) {[m case image_MediaType: {[m [31m- iAssert(!isEmpty_Rect(run->bounds));[m [31m- const iInt2 imgSize = imageSize_Media(constMedia_GmDocument(doc), linkMedia);[m [31m- format_String(&text, "%s \u2014 %d x %d \u2014 %.1f%s",[m [31m- info.type, imgSize.x, imgSize.y, info.numBytes / 1.0e6f,[m [31m- cstr_Lang("mb"));[m [32m+[m[32m /* There's a separate decorative GmRun for the metadata. */[m break;[m }[m case audio_MediaType:[m [36m@@ -4883,6 +4871,7 @@[m [mstatic void drawRun_DrawContext_(void *context, const iGmRun *run) {[m break;[m }[m if (linkMedia.type != download_MediaType && /* can't cancel downloads currently */[m [32m+[m[32m linkMedia.type != image_MediaType &&[m[41m [m findMediaRequest_DocumentWidget_(d->widget, run->linkId)) {[m appendFormat_String([m &text, " %s" close_Icon, isHover ? escape_Color(tmLinkText_ColorId) : "");[m [36m@@ -4911,6 +4900,7 @@[m [mstatic void drawRun_DrawContext_(void *context, const iGmRun *run) {[m }[m }[m else if (isHover) {[m [32m+[m[32m /* TODO: Make this a dynamic overlay, not part of the VisBuf content. */[m const iGmLinkId linkId = d->widget->hoverLink->linkId;[m const iString * url = linkUrl_GmDocument(doc, linkId);[m const int flags = linkFlags;[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).