fix(viewport): properly truncate to size#228
Merged
meowgorithm merged 2 commits intocharmbracelet:masterfrom Sep 2, 2022
Merged
fix(viewport): properly truncate to size#228meowgorithm merged 2 commits intocharmbracelet:masterfrom
meowgorithm merged 2 commits intocharmbracelet:masterfrom
Conversation
Member
Contributor
Author
|
Ok I've updated it. But note that your example here sets a width in the style, which none of the bubbles really support well (I'm fixing viewport in this PR, but the other bubbles will remain weird in that case). This of course would benefit from unit tests. I'll send a separate PR for that. |
There are many "interesting" cases: - logical content is wider than display width (long lines). In this case, we truncate. - logical content is smaller than display height (fewer lines than visible). In this case, we pad with empty lines up to the specified height. - logical content is higher than display height (more lines than visible). In this case, we truncate. - style specifies a width wider than the display width. In this case, we ignore the style width and fit in the display width. - style specifies a height higher than the display height. Same as width, we ignore the style and fit in the display height. - style specifies a narrower width or smaller height than the display. In this case we obey the style.
Member
|
Nicely done, @knz. I've played with it a bit and it seems perfect now.
If you're referring to this part, it's only for text wrapping, which I imagine is an opt-in feature we should add at some point. |
ReallyLiri
pushed a commit
to ReallyLiri/bubbles
that referenced
this pull request
Jun 13, 2024
There are many "interesting" cases: - logical content is wider than display width (long lines). In this case, we truncate. - logical content is smaller than display height (fewer lines than visible). In this case, we pad with empty lines up to the specified height. - logical content is higher than display height (more lines than visible). In this case, we truncate. - style specifies a width wider than the display width. In this case, we ignore the style width and fit in the display width. - style specifies a height higher than the display height. Same as width, we ignore the style and fit in the display height. - style specifies a narrower width or smaller height than the display. In this case we obey the style.
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.
Fixes #227
logical content is wider than display width (long lines).
In this case, we truncate.
logical content is smaller than display height (fewer lines
than visible).
In this case, we pad with empty lines up to the specified height.
logical content is higher than display height (more lines than
visible).
In this case, we truncate.
style specifies a width wider than the display width.
In this case, we ignore the style width and
fit in the display width.
style specifies a height higher than the display height.
Same as width, we ignore the style and fit in the display height.
style specifies a narrower width or smaller height than the display.
In this case we obey the style.
cc @meowgorithm