SecondHalfGames / yakui

yakui is a declarative Rust UI library for games
Apache License 2.0
222 stars 18 forks source link

Backspace in text boxes that were just cleared causes a crash #168

Closed iggedi-ig-ig closed 2 weeks ago

iggedi-ig-ig commented 3 weeks ago

Description

After a text box was cleared, trying to delete from the (now empty) text box using backspace crashes the program.

Reproduce

Run the clear_textbox example. Enter anything that is not an empty string into the textbox (it contains "Hello" by default, which is fine). Press "Clear". Then press Backspace in the textbox.

Logs

thread 'main' panicked at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/string.rs:1933:29:
assertion failed: self.is_char_boundary(n)