Skip to content

EditableText change detection using parley::Generation#23785

Open
ickshonpe wants to merge 31 commits intobevyengine:mainfrom
ickshonpe:editable-text-fixes
Open

EditableText change detection using parley::Generation#23785
ickshonpe wants to merge 31 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.

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.

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
@github-project-automation github-project-automation bot moved this to Needs SME Triage in UI Apr 13, 2026
@ickshonpe ickshonpe added D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes C-Bug An unexpected or incorrect behavior labels Apr 13, 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-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

1 participant