-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Helix crashes after inputing emojies. #6645
Comments
I was able to reproduce this. However, it seems like this is not an issue in helix, but rather in the unicode_segmentation crate, possibly covered by this issue |
Backtrace in debug mode...
on 3dd715a |
Having another look at this, I think the issue is that the unicode_segmentation crate expects indices into slices to be at the start of unicode sequences, this is something that could be checked in helix before calling the crate's functions. Edit: I created a branch to try and understand/fix this issue, however I am not very familiar with the helix codebase and the solution feels very "hacky". Should I still open a PR for feedback? |
- Added functions `is_unicode_boundary_byte`, `prev_unicode_boundary` and `next_unicode_boundary` - Added unicode boundary checks before calling `GraphemeCursor` functions
This check won't be included in the unicode-segmentation crate (for now), see unicode-rs/unicode-segmentation#120 |
This issue was happening with me using both kitty and wezterm. |
I also hit this while running the digraphs patch. |
I am not sure but this might have been fixed by #7417 could you try on master and see if you this crash still happens? |
I haven't been able to reproduce it unfortunately, I just got a traceback of the same panic pointing to The digraph patch was on top of master and the crash occured while mucking about with entering and copying and pasting unicode characters using |
Another data point in case it's helpful, I'm able to get Helix @
Stacktracehelix on master [$…] is 📦 v23.10.0 via 🦀 v1.70.0 direnv loaded/denied ❯ env RUST_BACKTRACE=1 cargo run -- -vv Finished dev [unoptimized + debuginfo] target(s) in 0.08s Running `target/debug/hx -vv` thread 'main' panicked at 'byte index 24 is not a char boundary; it is inside '😆' (bytes 23..27) of `int main() { printf("😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆😆`[...]', /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-seg stack backtrace: pp 0: rust_begin_unwind at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5 1: core::panicking::panic_fmt at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14 2: core::str::slice_error_fail_rt 3: core::str::slice_error_fail at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/str/mod.rs:86:9 4: core::str::traits:: for core::ops::range::RangeFrom>::index at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/str/traits.rs:382:21 5: core::str::traits:: for str>::index at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/str/traits.rs:62:9 6: unicode_segmentation::grapheme::GraphemeCursor::is_boundary at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-segmentation-1.11.0/src/grapheme.rs:553:22 7: helix_core::graphemes::is_grapheme_boundary_byte at ./helix-core/src/graphemes.rs:340:15 8: helix_core::graphemes::ensure_grapheme_boundary_next_byte at ./helix-core/src/graphemes.rs:290:12 9: helix_term::ui::editor::EditorView::doc_syntax_highlights::{{closure}} at ./helix-term/src/ui/editor.rs:326:51 10: core::ops::function::impls:: for &mut F>::call_once at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:310:13 11: core::option::Option::map at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/option.rs:1099:29 12: as core::iter::traits::iterator::Iterator>::next at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:103:9 13: as core::iter::traits::iterator::Iterator>::next at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1907:9 14: as core::iter::traits::iterator::Iterator>::next at ./helix-term/src/ui/document.rs:49:33 15: helix_term::ui::document::render_text at ./helix-term/src/ui/document.rs:283:33 16: helix_term::ui::document::render_document at ./helix-term/src/ui/document.rs:107:5 17: helix_term::ui::editor::EditorView::render_view at ./helix-term/src/ui/editor.rs:197:9 18: ::render at ./helix-term/src/ui/editor.rs:1450:13 19: helix_term::compositor::Compositor::render at ./helix-term/src/compositor.rs:178:13 20: helix_term::application::Application::render::{{closure}} at ./helix-term/src/application.rs:278:9 21: helix_term::application::Application::handle_terminal_events::{{closure}} at ./helix-term/src/application.rs:651:26 22: helix_term::application::Application::event_loop_until_idle::{{closure}} at ./helix-term/src/application.rs:320:55 23: helix_term::application::Application::event_loop::{{closure}} at ./helix-term/src/application.rs:294:57 24: helix_term::application::Application::run::{{closure}} at ./helix-term/src/application.rs:1199:38 25: hx::main_impl::{{closure}} at ./helix-term/src/main.rs:161:53 26: tokio::runtime::park::CachedParkThread::block_on::{{closure}} at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/park.rs:281:63 27: tokio::runtime::coop::with_budget at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/coop.rs:107:5 28: tokio::runtime::coop::budget at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/coop.rs:73:5 29: tokio::runtime::park::CachedParkThread::block_on at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/park.rs:281:31 30: tokio::runtime::context::blocking::BlockingRegionGuard::block_on at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/context/blocking.rs:66:9 31: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}} at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/scheduler/multi_thread/mod.rs:87:13 32: tokio::runtime::context::runtime::enter_runtime at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/context/runtime.rs:65:16 33: tokio::runtime::scheduler::multi_thread::MultiThread::block_on at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/scheduler/multi_thread/mod.rs:86:9 34: tokio::runtime::runtime::Runtime::block_on at /home/mandx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/runtime.rs:350:45 35: hx::main_impl at ./helix-term/src/main.rs:163:5 36: hx::main at ./helix-term/src/main.rs:37:21 37: core::ops::function::FnOnce::call_once at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. Here's the interesting part, I don't get a panic if I don't change the syntax (that is, leave it as language |
Summary
The editor crashes after adding emojies, I don't have much information so ill add a video and the full backtrace.
Screencast.from.2023-04-07.16-34-05.webm
Rust Backtrace
~/.cache/helix/helix.log
Platform
Linux
Terminal Emulator
gnome-console
Helix Version
helix 23.03
The text was updated successfully, but these errors were encountered: