gpui: Implement inline box text layout - #26307
Closed
MatinAniss wants to merge 4 commits into
Closed
Conversation
MatinAniss
marked this pull request as ready for review
March 9, 2025 00:25
huacnlee
reviewed
Mar 10, 2025
| .text_color(gpui::white()) | ||
| .child( | ||
| div().border_1().border_color(gpui::red()).child( | ||
| InlineText::new() |
Contributor
There was a problem hiding this comment.
Why not use span, Span::new, like the before div.
And the next add_text, add_element.
I think we can try to have a better API like this if it's possible:
div().id("paragraph")
.child(span("This is an inline element ->"))
.child(span().w_4().bg(gpui::red()))
.child(span("text"))Or at least we can:
div().id("paragraph")
.child(
InlineText::new()
.child("This is an inline element ->")
.child(div().w_4().bg(gpui::red()))
.child("text")
)
Member
|
This is a good idea, and one we really want to have in Zed. However, I'm not convinced on the API yet, I'd think this would be a display mode on the div, right? I've let this one languish, so I'm going to close it for now. |
Contributor
Author
|
Agreed, I wasn't too confident on my implementation and It would be better to utilise Parley instead but that requires some larger changes that I haven't had the time to look into deeply. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an implementation of inline boxes in text layouts, this allows you to have spaces at certain points of your text layout where you can have "inline elements" in these spaces that flow with your text layout.
The
gpuitext system should look into moving to Parley in the future, which already supports text layouting features such as inline text boxes. Moving to Parley would require some much larger changes but will be better in the long run.Closes #10916
Current State:
text-inline.mp4
Release Notes: