Fix TextEdit hint text not following horizontal_align/vertical_align#8332
Open
thedavidweng wants to merge 2 commits into
emilk:mainemilk/egui:mainfrom
thedavidweng:fix-textedit-hint-alignmentthedavidweng/egui:fix-textedit-hint-alignmentCopy head branch name to clipboard
Open
Fix TextEdit hint text not following horizontal_align/vertical_align#8332thedavidweng wants to merge 2 commits intoemilk:mainemilk/egui:mainfrom thedavidweng:fix-textedit-hint-alignmentthedavidweng/egui:fix-textedit-hint-alignmentCopy head branch name to clipboard
thedavidweng wants to merge 2 commits into
emilk:mainemilk/egui:mainfrom
thedavidweng:fix-textedit-hint-alignmentthedavidweng/egui:fix-textedit-hint-alignmentCopy head branch name to clipboard
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/8332-fix-textedit-hint-alignment View snapshot changes at kitdiff |
thedavidweng
force-pushed
the
fix-textedit-hint-alignment
branch
from
July 22, 2026 09:46
3ca348c to
7e95948
Compare
The hint text was always aligned to LEFT_TOP, ignoring the alignment set with TextEdit::horizontal_align/vertical_align. This made the hint text, the cursor, and the typed text disagree on alignment (e.g. a centered TextEdit showed a left-aligned hint with a centered cursor). Use the widget's align for the hint text atoms so the hint matches the input text. The default align is still LEFT_TOP, so multi line text edits are unchanged. Also silence a pre-existing clippy::unnecessary_wraps warning in egui_kittest::app_kind that fires when building egui_kittest without the eframe feature (the Option wrap is required when eframe is enabled). Closes emilk#8309.
thedavidweng
force-pushed
the
fix-textedit-hint-alignment
branch
from
July 22, 2026 09:53
7e95948 to
5f758c1
Compare
rustybuzz was flagged as unmaintained (RUSTSEC-2026-0206) on 2026-07-12, after the previous deny fix (emilk#8300) was merged. It is pulled in transitively via resvg/usvg, used by egui_extras for SVG support. resvg cannot be bumped yet due to a tiny-skia version conflict (see comment in Cargo.toml), and the recommended replacement (harfrust) has not been adopted by resvg. Following the same pattern as the existing ignored advisories (ttf-parser, quick-xml), add RUSTSEC-2026-0206 to the ignore list until resvg can be updated. This restores the cargo-deny CI checks to green.
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.
Summary
TextEdithint text was always aligned toAlign2::LEFT_TOP, ignoring the alignment set viaTextEdit::horizontal_align/vertical_align. This caused the hint text, the cursor, and the typed text to disagree on alignment: e.g. a centeredTextEditshowed a left-aligned hint with a centered cursor.The hint text atoms now use the widget's
align, so the hint matches the input text alignment. The defaultalignis stillLEFT_TOP, so multi line text edits (and the default styling) are unchanged.Root cause
In
crates/egui/src/widgets/text_edit/builder.rs, the hint-text branch hardcoded:while the input-text branch used
.atom_align(self.align). The hint path now usesalignas well.Drive-by: silence
clippy::unnecessary_wrapsinegui_kittest::app_kindAppKind::runreturnsOption<egui::Response>. TheOptionwrap is required when theeframefeature is enabled (theEframebranch returnsNone), butclippy::unnecessary_wrapsfires whenegui_kittestis built standalone without theeframefeature (e.g.cargo clippy -p egui_kittest). The workspace CI run doesn't hit it because feature unification viaegui_demo_appenableseframe, but it's a real annoyance for anyone linting the crate on its own. Added a scoped#[cfg_attr(not(feature = "eframe"), expect(clippy::unnecessary_wraps))]with an explanatory comment.Test plan
textedit_hint_text_should_follow_text_alignmentkittest regression incrates/egui_kittest/tests/regression_tests.rs. It fails before the fix (hint_center_x=24.25vsedit_center_x=100) and passes after.cargo test -p eguicargo test -p egui_kittest --all-features --test regression_testscargo clippy -p egui_kittest --all-features --test regression_tests -- -D warningsRUSTFLAGS="-D warnings" cargo clippy -p egui_kittest --lib(pre-existingunnecessary_wrapsnow silenced)cargo clippy -p egui -- -D warningscargo fmt --check