Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Regression: Deleting in Strings with multi-byte-characters panics #56

Closed
frederictobiasc opened this issue Jul 5, 2024 · 4 comments · Fixed by #57
Closed

Regression: Deleting in Strings with multi-byte-characters panics #56

frederictobiasc opened this issue Jul 5, 2024 · 4 comments · Fixed by #57

Comments

@frederictobiasc
Copy link
Contributor

The panicking I previously fixed in #41 was reintroduced by #46

So now, the following panics:

fn main() {
    let mut test = TextState::new();
    test.push('Ö');
    test.push('a');
    test.backspace();
}

Result:

thread 'main' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/string.rs:1449:28:
byte index 1 is not a char boundary; it is inside 'Ö' (bytes 0..2) of `Öa`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@joshka
Copy link
Owner

joshka commented Jul 5, 2024

Thanks for the heads up. I'll change this to use the floor of the character boundary instead.

@joshka
Copy link
Owner

joshka commented Jul 5, 2024

Can you please take a look at #56 and check that it solves your issue?

@frederictobiasc
Copy link
Contributor Author

It does, thanks!

@joshka joshka closed this as completed in #57 Jul 8, 2024
@joshka joshka closed this as completed in 6060efe Jul 8, 2024
@joshka
Copy link
Owner

joshka commented Jul 8, 2024

joshka added a commit to joshka/tui-widgets that referenced this issue Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants