Skip to content

EditableText change detection using parley::Generation#23785

Merged
alice-i-cecile merged 43 commits intobevyengine:mainfrom
ickshonpe:editable-text-fixes
Apr 19, 2026
Merged

EditableText change detection using parley::Generation#23785
alice-i-cecile merged 43 commits intobevyengine:mainfrom
ickshonpe:editable-text-fixes

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented Apr 13, 2026

Objective

Improved change detection for EditableText.

Fixes #23793

Solution

  • Remove the text_edited field from EditableText that was used for manual change detection.
  • Use the PlainEditor's Generation to track changes.
  • New component EditableTextGeneration. Newtypes parley::Generation. Stores the generation from the last TextLayoutInfo update.
  • If EditableText::editor's and EditableTextGeneration's generation values aren't equal, reupdate TextLayoutInfo.
  • Added support for TextLayout::justify.
  • Split up editable_text_system into two systems update_editable_text_styles and update_editable_text_layout. The text input's style values need to be updated before layout, so the measure func returns the correct size for the text layout.
  • New EditableText testbed_ui scene.
  • Added two numeric inputs to multiline_text_input that allow you to set the height of the multiline input and its fontsize.
  • Update selection rects on all changes, not just when a text input is focused.

Testing

cargo run --example multiline_text_input

The cursor appears to be missing for the numeric inputs in the example but it isn't. The cursor gets clipped because it's at the end of the right aligned input value text. If you press left it comes into view. Cursor and scrolling behaviour needs some adjustments but that's out of the scope of this PR.

…lear method otherwise the `TextLayoutInfo` is not updated again because the dirty flags get reset.
@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 13, 2026
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 15, 2026
Copy link
Copy Markdown
Contributor

@Zeophlite Zeophlite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice

@ickshonpe ickshonpe added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Apr 16, 2026
@ickshonpe
Copy link
Copy Markdown
Contributor Author

I think everything is good now. There are some weird CI errors that I don't think are to do with this PR?

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 16, 2026
auto-merge was automatically disabled April 19, 2026 17:59

Head branch was pushed to by a user without write access

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 19, 2026
Merged via the queue into bevyengine:main with commit 8b8a432 Apr 19, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in UI Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Text Rendering and layout for characters A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

TextEdit::SelectAll and TextEdit::CollapseSelection do not affect highlighting

4 participants