Skip to content

EditableText max characters limit#23496

Merged
alice-i-cecile merged 4 commits intobevyengine:mainfrom
ickshonpe:editable-text-max-characters
Mar 24, 2026
Merged

EditableText max characters limit#23496
alice-i-cecile merged 4 commits intobevyengine:mainfrom
ickshonpe:editable-text-max-characters

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

Objective

Add a max characters limit to EditableText

Solution

  • New field max_characters: Option<usize> on EditableText.
  • Queued TextEdits that would cause the text to exceed max_characters (if some) are ignored.

Testing

cargo run --example editable_text

The right input's max character limit is set to 7.

Edits that would increase the length of the text to greater than `max_characters` are ignored.
Copy link
Copy Markdown
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

This might be a nice place for some tests, but I won't block on it.

@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters labels Mar 24, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in UI Mar 24, 2026
@ickshonpe ickshonpe added C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Mar 24, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Mar 24, 2026
Merged via the queue into bevyengine:main with commit c235fc1 Mar 24, 2026
38 checks passed
@github-project-automation github-project-automation bot moved this from Needs SME Triage to Done in UI Mar 24, 2026
splo pushed a commit to splo/bevy that referenced this pull request Mar 31, 2026
# Objective

Add a max characters limit to `EditableText`

## Solution

- New field `max_characters: Option<usize>` on `EditableText`.
- Queued `TextEdit`s that would cause the text to exceed
`max_characters` (if some) are ignored.

## Testing

```
cargo run --example editable_text
```

The right input's max character limit is set to 7.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
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-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples 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.

3 participants