Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal exit when type not english characters #26

Closed
PxyUp opened this issue Oct 8, 2019 · 4 comments
Closed

Fatal exit when type not english characters #26

PxyUp opened this issue Oct 8, 2019 · 4 comments

Comments

@PxyUp
Copy link

PxyUp commented Oct 8, 2019

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

@PxyUp PxyUp changed the title No Fatal exit when type not english characters Oct 8, 2019
@Rigellute
Copy link
Owner

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

@PxyUp
Copy link
Author

PxyUp commented Oct 8, 2019

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

@fangyi-zhou
Copy link
Contributor

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

@filiphe
Copy link

filiphe commented 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

Rigellute added a commit that referenced this issue Oct 18, 2019
Insert input into correct character boundary (#26)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants