Merged
Conversation
Collaborator
|
@zakarumych unfortunately there is a merge conflict now 🙁 can you update your branch? |
|
Preview available at https://egui-pr-preview.github.io/pr/5547-texteditlayoutfix |
TextEdit's in RTL layouts
lucasmerlin
pushed a commit
that referenced
this pull request
Sep 11, 2025
Co-authored-by: Emil Ernerfeldt <[email protected]>
Masterchef365
pushed a commit
to Masterchef365/egui
that referenced
this pull request
Apr 3, 2026
Co-authored-by: Emil Ernerfeldt <[email protected]>
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.
TextEdit sometimes allocates extra space if text changes and no longer fits into previously allocated Rect.
It also can happen when rounding error occurs. In this case extra space is extra small.
If extra space is needed,
Ui::allocate_rectis used to carve that space from placer.However it always allocated extra space on the bottom-right from the rect placer returned initially.
This works well on Left-to-Right and Top-to-bottom layouts.
However in case it's Right-to-Left,
Ui::allocate_rectupdates placer's cursor and puts it to the right side of the initially allocated rect. And next widget is then placed over the TextEdit.This is hard to notice usually.
However I have scaling that can cause rounding errors, so 0.0003 units of extra space is allocated each frame. Making next widget to overlap the TextEdit almost entirely.
This changes makes extra space allocation aware of the layout main direction and it picks most appropriate side of the widget for the extra space.