Closed jorpic closed 1 year ago
According to git bisect
this was introduced in 9c6c63a2be30252a6207f4aebb5e0f76f746b4c8
As I understand, bug is any symbols added before shebang (it must be correct) will move highlighting forward, and helix crashes when it reaches the end.
For example, you could write
```bash
#!/usr/bin/env bash
```
678
and then start add 9 any symbols before shebang, say, after
```bash
until editor crashes. Let's count: new line, three `, new line, "678", another new line. On next symbol, added before shebang, helix crashes.
I do not understand how the highlight works, just sharing my observations.
Having the same kind of error trying to copy the first line (```bash
with the EOL so ggxyP
)
Summary
It crashes.
Reproduction Steps
I tried this:
RUST_BACKTRACE=1 hx -vv bug.md
ggjxyggP
.I expected to get this text:
thread 'main' panicked at 'assertion failed: byte_idx <= slice.len_bytes()', helix-core/src/graphemes.rs:330:5 stack backtrace: 0: rust_begin_unwind at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14 2: core::panicking::panic at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:48:5 3: helix_core::graphemes::is_grapheme_boundary_byte at ./helix-core/src/graphemes.rs:330:5 4: helix_core::graphemes::ensure_grapheme_boundary_next_byte at ./helix-core/src/graphemes.rs:290:12 5: helix_term::ui::editor::EditorView::doc_syntax_highlights::{{closure}} at ./helix-term/src/ui/editor.rs:313:51 6: core::ops::function::impls::<impl core::ops::function::FnOnce for &mut F>::call_once at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:306:13 7: core::option::Option::map
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/option.rs:929:29
8: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/iter/adapters/map.rs:103:9
9: <alloc::boxed::Box<I,A> as core::iter::traits::iterator::Iterator>::next
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1874:9
10: <helix_core::syntax::Merge as core::iter::traits::iterator::Iterator>::next
at ./helix-core/src/syntax.rs:2373:35
11: <alloc::boxed::Box<I,A> as core::iter::traits::iterator::Iterator>::next
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1874:9
12: <helix_term::ui::document::StyleIter as core::iter::traits::iterator::Iterator>::next
at ./helix-term/src/ui/document.rs:49:33
13: helix_term::ui::document::render_text
at ./helix-term/src/ui/document.rs:264:26
14: helix_term::ui::document::render_document
at ./helix-term/src/ui/document.rs:106:5
15: helix_term::ui::editor::EditorView::render_view
at ./helix-term/src/ui/editor.rs:188:9
16: ::render
at ./helix-term/src/ui/editor.rs:1412:13
17: helix_term::compositor::Compositor::render
at ./helix-term/src/compositor.rs:170:13
18: helix_term::application::Application::render::{{closure}}
at ./helix-term/src/application.rs:289:9
19: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
20: helix_term::application::Application::handle_terminal_events::{{closure}}
at ./helix-term/src/application.rs:671:26
21: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
22: helix_term::application::Application::event_loop_until_idle::{{closure}}
at ./helix-term/src/application.rs:332:55
23: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
24: helix_term::application::Application::event_loop::{{closure}}
at ./helix-term/src/application.rs:306:57
25: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
26: helix_term::application::Application::run::{{closure}}
at ./helix-term/src/application.rs:1133:38
27: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
28: hx::main_impl::{{closure}}
at ./helix-term/src/main.rs:157:53
29: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
30: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/park.rs:283:63
31: tokio::runtime::coop::with_budget
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/coop.rs:107:5
32: tokio::runtime::coop::budget
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/coop.rs:73:5
33: tokio::runtime::park::CachedParkThread::block_on
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/park.rs:283:31
34: tokio::runtime::context::BlockingRegionGuard::block_on
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/context.rs:315:13
35: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/scheduler/multi_thread/mod.rs:66:9
36: tokio::runtime::runtime::Runtime::block_on
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/runtime.rs:304:45
37: hx::main_impl
at ./helix-term/src/main.rs:159:5
38: hx::main
at ./helix-term/src/main.rs:38:21
39: core::ops::function::FnOnce::call_once
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with
RUST_BACKTRACE=full
for a verbose backtrace.2023-06-23T17:42:32.667 helix_loader [DEBUG] runtime dir: /home/user/t/helix/runtime 2023-06-23T17:42:32.686 helix_view::clipboard [DEBUG] Using wl-copy+wl-paste to interact with the system and selection (primary) clipboard 2023-06-23T17:42:32.728 helix_vcs [INFO] file is untracked 2023-06-23T17:42:32.728 helix_vcs [INFO] failed to open diff base for /home/user/t/helix/bug.md 2023-06-23T17:42:32.731 helix_view::editor [ERROR] Failed to initialize the language servers for
source.md
{ cannot find binary path } 2023-06-23T17:42:32.731 helix_view::editor [DEBUG] editor status: Loaded 1 file. 2023-06-23T17:42:32.733 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is not supported in this terminal (checked in 383.016µs) 2023-06-23T17:42:32.735 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-06-23T17:42:33.088 helix_term::application [DEBUG] received editor event: IdleTimer 2023-06-23T17:42:34.445 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-06-23T17:42:34.842 helix_term::application [DEBUG] received editor event: IdleTimer 2023-06-23T17:42:34.847 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-06-23T17:42:35.307 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-06-23T17:42:35.489 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-06-23T17:42:35.813 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-06-23T17:42:36.211 helix_term::application [DEBUG] received editor event: IdleTimer 2023-06-23T17:42:36.216 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 2023-06-23T17:42:36.533 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0 ...