cosmic-text icon indicating copy to clipboard operation
cosmic-text copied to clipboard

Panic with strange file

Open qarmin opened this issue 1 year ago • 1 comments

Modifying editor-test

    let text = if let Some(arg) = env::args().nth(1) {
        fs::read_to_string(&arg).expect("failed to open file")
    } else {
        #[cfg(feature = "mono")]
        let default_text = include_str!("../../../sample/a.txt");
        #[cfg(not(feature = "mono"))]
        let default_text = include_str!("../../../sample/a.txt");
        default_text.to_string()
    };

and putting to sample file - ss.txt.zip

crash app with info

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `Cursor { line: 0, index: 11747, affinity: After }`,
 right: `Cursor { line: 0, index: 11743, affinity: After }`', examples/editor-test/src/main.rs:99:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

qarmin avatar Mar 27 '23 20:03 qarmin

@quarmin This is because your file contains a U+009A | Single Character Intro Introducer which cosmic text does not insert because it is a unicode control character:

Refusing to insert control character '\u{9a}'

0HyperCube avatar Jun 25 '23 09:06 0HyperCube