Fixes sense issues in TextEdit when vertical alignment is used#7436
Merged
emilk merged 6 commits intoemilk:mainfrom Aug 12, 2025
Merged
Fixes sense issues in TextEdit when vertical alignment is used#7436emilk merged 6 commits intoemilk:mainfrom
emilk merged 6 commits intoemilk:mainfrom
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/7436-alignfix |
lucasmerlin
approved these changes
Aug 8, 2025
Collaborator
lucasmerlin
left a comment
There was a problem hiding this comment.
Nice!
Just for the record, here is a video of the bug and fix:
Screen.Recording.2025-08-08.at.14.24.12.mov
Screen.Recording.2025-08-08.at.14.25.07.mov
| }; | ||
|
|
||
| let mut offset_x = state.singleline_offset; | ||
| let mut offset_x = state.text_offset[0]; |
Collaborator
There was a problem hiding this comment.
Suggested change
| let mut offset_x = state.text_offset[0]; | |
| let mut offset_x = state.text_offset.x; |
A bit more idiomatic
lucasmerlin
reviewed
Aug 8, 2025
Comment on lines
52
to
53
| // Visual offset when editing singleline text bigger than the width. | ||
| #[cfg_attr(feature = "serde", serde(skip))] |
Collaborator
There was a problem hiding this comment.
Ah yeah it'd be nice if you could update the comment
emilk
reviewed
Aug 12, 2025
Comment on lines
+655
to
+656
| let align_offset_x = rect.left() - galley_pos.x; | ||
| let align_offset_y = rect.top() - galley_pos.y; |
Owner
There was a problem hiding this comment.
Suggested change
| let align_offset_x = rect.left() - galley_pos.x; | |
| let align_offset_y = rect.top() - galley_pos.y; | |
| let align_offset = rect.left_top() - galley_pos; |
emilk
approved these changes
Aug 12, 2025
Masterchef365
pushed a commit
to Masterchef365/egui
that referenced
this pull request
Apr 3, 2026
…#7436) <!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> * Closes <emilk#7433> * [ ] I have followed the instructions in the PR template I'm running a rustup-less rust install on Windows, so I don't have `clippy` nor `fmt` and can't run the .sh script. It's very little code and I manually tested this, so hopefully that's ok... Let me know if the comment in `state.rs` needs to be updated or the `text_offset` name isn't clear enough. --------- 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.
vertical_align#7433I'm running a rustup-less rust install on Windows, so I don't have
clippynorfmtand can't run the .sh script.It's very little code and I manually tested this, so hopefully that's ok...
Let me know if the comment in
state.rsneeds to be updated or thetext_offsetname isn't clear enough.