Column::remainder().clip(true) now shrinks when available width decreases#8048
Open
germ4n wants to merge 1 commit intoemilk:mainfrom
Open
Column::remainder().clip(true) now shrinks when available width decreases#8048germ4n wants to merge 1 commit intoemilk:mainfrom
Column::remainder().clip(true) now shrinks when available width decreases#8048germ4n wants to merge 1 commit intoemilk:mainfrom
Conversation
|
Preview is being built... Preview will be available at https://egui-pr-preview.github.io/pr/8048-fix-remainder-clip-shrink View snapshot changes at kitdiff |
Column::remainder().clip(true) now shrinks when available width decreases
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.
Problem
Column::remainder().clip(true)grows correctly when the panel is made wider, but does not shrink when the panel is made narrower.Root cause
There are two places in
table.rswhere themax_used_widthsfloor is applied to column widths. One correctly checkscolumn.clip, the other doesn't.Post-render path (already correct, line ~827):
TableState::loadpre-render path (the bug, line 647):In
TableState::load,.at_least(max_used)is applied to every column regardless ofclip. For aColumn::remainder(),max_usedaccumulates the historically widest rendered content. When the panel shrinks, this floor prevents the column from computing a smaller width, creating a cycle where it can never shrink.Fix
Apply the same
clipguard that already exists in the post-render path:When
clip = true, the floor is justwidth_range.min(0.0 by default), allowing the remainder column to shrink freely to the actual remaining space.Minimal reproduction
Without the fix: make the window wider (column grows ✓), then narrower — column does not shrink and a horizontal scrollbar appears ✗
fix-remainder-clip-shrink-before.mp4
With the fix: the column shrinks correctly and no scrollbar appears ✓
fix-remainder-clip-shrink-after.mp4