-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fixes sense issues in TextEdit when vertical alignment is used #7436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Preview available at https://egui-pr-preview.github.io/pr/7436-alignfix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut offset_x = state.text_offset[0]; | |
let mut offset_x = state.text_offset.x; |
A bit more idiomatic
// Visual offset when editing singleline text bigger than the width. | ||
#[cfg_attr(feature = "serde", serde(skip))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah it'd be nice if you could update the comment
let align_offset_x = rect.left() - galley_pos.x; | ||
let align_offset_y = rect.top() - galley_pos.y; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
vertical_align
#7433I'm running a rustup-less rust install on Windows, so I don't have
clippy
norfmt
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 thetext_offset
name isn't clear enough.