mirror of
https://github.com/bevyengine/bevy.git
synced 2026-05-06 06:06:42 -04:00
211b9ab63f
# Objective Fix some scrolling jitters and bugs. * The cursor can be scrolled out of view. * Horizontal scrolling is jittery with a cursor taller then the line height. * Vertical scrolling jitters. * Scrolling and cursor state should only update on changes to the editor state and input focus (this is needed so scroll bars will work with a text input). Fixes #23931 ## Solution * Use the full cursor width when calculating the horizontal scroll offset. * Base vertical offsets on the bounds of the current visual line, not the cursor. * Update scrolling on `InputFocus` changes. * `TextLayoutInfo` always holds the cursor geometry (if there is a cursor), made the field a `(bool, Rect)` tuple, the bool is true if the cursor should be rendered. * Lots of clamping, logic behind it mostly trial and error tbh. This should fix the major scrolling bugs, scrolling should feel consistant and intuitive now. Left look-ahead scrolling https://github.com/bevyengine/bevy/issues/23933 left for a follow up, after this is merged. ## Testing ``` cargo run --example multiple_text_inputs cargo run --example multiline_text_input cargo run --example ime_support --features="system_font_discovery" ``` With `ime_support` and `multiline_text_input`, you probably want to set `TextLayout::new_with_no_wrap()` on the inputs to fully appreciate the changes.