[GH-ISSUE #26] Fatal exit when type not english characters #24

Closed
opened 2026-02-28 14:46:26 +03:00 by kerem · 4 comments
Owner

Originally created by @PxyUp on GitHub (Oct 8, 2019).
Original GitHub issue: https://github.com/Rigellute/spotify-tui/issues/26

When you try to find any not English characters application did fatal exit

Originally created by @PxyUp on GitHub (Oct 8, 2019). Original GitHub issue: https://github.com/Rigellute/spotify-tui/issues/26 When you try to find any not English characters application did fatal exit
kerem closed this issue 2026-02-28 14:46:26 +03:00
Author
Owner

@Rigellute commented on GitHub (Oct 8, 2019):

Huh interesting, could you share the characters you used that caused the fatal exit?

<!-- gh-comment-id:539658974 --> @Rigellute commented on GitHub (Oct 8, 2019): Huh interesting, could you share the characters you used that caused the fatal exit?
Author
Owner

@PxyUp commented on GitHub (Oct 8, 2019):

@Rigellute 'ыаываываайцайцайцайцайцаймямцу'
Any of that

<!-- gh-comment-id:539662183 --> @PxyUp commented on GitHub (Oct 8, 2019): @Rigellute 'ыаываываайцайцайцайцайцаймямцу' Any of that
Author
Owner

@fangyi-zhou commented on GitHub (Oct 8, 2019):

This is caused by inserting into a string outside word boundary, I'm submitting a PR to fix it

<!-- gh-comment-id:539666109 --> @fangyi-zhou commented on GitHub (Oct 8, 2019): This is caused by inserting into a string outside word boundary, I'm submitting a PR to fix it
Author
Owner

@filiphe commented on GitHub (Oct 16, 2019):

Here's a test that currently fails on "non-english" input.

#[test]
    fn test_input_handler_on_enter_non_english_text() {
        let mut app = App::new();

        app.input = "My tex".to_string();
        app.input_cursor_position = app.input.len().try_into().unwrap();

        handler(Key::Char('ö'), &mut app);
        handler(Key::Char('ä'), &mut app);
        handler(Key::Char('å'), &mut app);
        handler(Key::Char('á'), &mut app);
        handler(Key::Char('þ'), &mut app);


        assert_eq!(app.input, "My texöäåáþ".to_string());
    }

Result from cargo test

---- handlers::input::tests::test_input_handler_on_enter_non_english_text stdout ----
thread 'handlers::input::tests::test_input_handler_on_enter_non_english_text' panicked at 'assertion failed: self.is_char_boundary(idx)', src/liballoc/string.rs:1287:9
<!-- gh-comment-id:542553518 --> @filiphe commented on GitHub (Oct 16, 2019): Here's a test that currently fails on "non-english" input. ``` #[test] fn test_input_handler_on_enter_non_english_text() { let mut app = App::new(); app.input = "My tex".to_string(); app.input_cursor_position = app.input.len().try_into().unwrap(); handler(Key::Char('ö'), &mut app); handler(Key::Char('ä'), &mut app); handler(Key::Char('å'), &mut app); handler(Key::Char('á'), &mut app); handler(Key::Char('þ'), &mut app); assert_eq!(app.input, "My texöäåáþ".to_string()); } ``` Result from `cargo test` ``` ---- handlers::input::tests::test_input_handler_on_enter_non_english_text stdout ---- thread 'handlers::input::tests::test_input_handler_on_enter_non_english_text' panicked at 'assertion failed: self.is_char_boundary(idx)', src/liballoc/string.rs:1287:9 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-tui#24
No description provided.