Introduce GPUI inline element - #48057
Conversation
|
Hey @benbrandt I understand why you had to close the other PR (#48074) that depended on this one. I still want to be clear that I intend to commit to getting inline rendering (the This PR also seemed to get a pretty positive / “good vibes” response from the community, which makes me think it’s solving a real pain point and not just an edge-case improvement. The closed PR was a good proof of concept: Beyond that, it also unlocks other long-standing needs, like:
Several of these have been top issues for a while, and they haven’t been solvable with the current Taffy-based rendering; the lack of inline support in Taffy is a known limitation across both projects. I’ve put a lot of effort into this already, and I’m willing to put in more to get it into an acceptable shape. If there are specific changes you need in this PR (approach, API shape, tests, benchmarks, etc.), tell me what “done” looks like and I’ll make it happen. //cc @mikayla-maki as I've saw Your comments on the other PR that tried to tackle this too #26307 (comment) |

Hi folks, I’d love a sanity check on whether this direction is a good fit for GPUI and worth taking to merge. I’ve built a full inline element that’s layout/styling‑equivalent to
div(), but supports true inline flow (text + elements in one run, proper wrapping around inline boxes). This will let a lot of new futures to be built into the Markdown, Agent Panel text rendering or anything other that needs custom inline flow system.Feature highlight:
inline()implementsStyled+InteractiveElement, so it supports the same style refinements, hover/click, and event wiring asdiv().TextRunsupport for syntax‑like styling viatext_runs/runs.InlineLayoutexposes text/plain_text, word ranges, bounds, and index↔position mapping (caret positioning and selection are supported).truncate,text_overflow, andline_clampare implemented end‑to‑end, including ellipsis styling and clipping for inline boxes.InlineLayoutCache) and there’s a benchmark comparing inline vs div for mixed text/box content.Anything
div()can do,inline()can do as well. The key difference is thatdiv()can’t mix text and other div elements on the same line with wrapping, whileinline()can.Here’s a video demo of the example app that’s included in the code.
Screen.Recording.2026-01-31.at.01.24.52.mov
Because
inline()mixes text and child elements, andrequest_layoutcan’t re‑measure children during layout, I addedrequest_layout_with_contextto make that possible without extra passes. The implementation now uses an aggressive per‑frame cache (similar totext_system). There’s still room to optimize, but performance is already close todiv().The dependent PR for native‑looking links is ready #48074 This work unlocks a first‑class
inline()element in Markdown, enabling rich inline rendering. With the new link‑renderer API, I was able to build properly styled, interactive links that sit seamlessly inside text.Mentions.Demo.1.mp4
With
inline()in place, Markdown can swap any inline fragment for a custom GPUI element. That’s howMentionUribecomes a first‑class, styled, fully interactive link.Closes #10916
Release Notes:
Inlineelement for GPUI