Repository navigation
Clip and ellipsize GTK labels - #4451
Merged
Merged
Conversation
Fixes beeware#3780. GTK labels are not clipped to their bounds; there is a native ellipsize option on the widget we should enable to automatically put ellipsis at the end of the text if necessary. Enabling this changes the way we use native functions to rehint, and the rehint code is modified accordingly. We should still clip the widget to bounds, however, because the user may set a very very tiny label that can't even fit a single ellipsis, but still we have to clip the label properly to avoid overflow. A drive-by fix to the example app involves bumping the width for the button box, as the buttons were hinted to >120px wide and was overlapping with the text.
johnzhou721
marked this pull request as ready for review
June 19, 2026 01:46
Contributor
Author
|
FWIW: I wasn't being very careful with PR management, and it turns out that with the current timeline, I'm exceeding the 2 PRs for review expectation. Drafting this again... |
johnzhou721
marked this pull request as draft
June 20, 2026 02:46
Contributor
Author
|
Closing due to an active change related to organizing my contributions. Feel free to pick this up again if this functionality is critical for your application. |
Contributor
Author
|
(My scaffold PR just merged and prepping the next one will take some time; so Im opening this for review again.) |
johnzhou721
marked this pull request as ready for review
November 6, 2026 12:33
freakboy3742
approved these changes
Nov 10, 2026
freakboy3742
left a comment
Member
There was a problem hiding this comment.
Nice work. I've made a slight tweak to the example so that it's more clear when truncation isn't working; but otherwise, this is a nice improvement.
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 #3780.
GTK labels are not clipped to their bounds; there is a native ellipsize option on the widget we should enable to automatically put ellipsis at the end of the text if necessary. Enabling this changes the way we use native functions to rehint, and the rehint code is modified accordingly.
We should still clip the widget to bounds, however, because the user may set a very very tiny label that can't even fit a single ellipsis, but still we have to clip the label properly to avoid overflow.
A drive-by fix to the example app involves bumping the width for the button box, as the buttons were hinted to >120px wide and was overlapping with the text.
PR Checklist: