-
-
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
Panic when incrementing two -1 values #2019
Comments
Putting the cursor on |
full backtrace:
|
I managed to reproduce this with a subset of the file (with about 240 lines): Test file (click to expand)
Backtrace:
Compiling in debug mode also triggered a debug assert: helix/helix-core/src/graphemes.rs Lines 35 to 38 in 59f0508
Debug backtracethread 'main' panicked at 'assertion failed: char_idx <= slice.len_chars()', helix-core/src/graphemes.rs:37:5
stack backtrace:
0: rust_begin_unwind
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
2: core::panicking::panic
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:48:5
3: helix_core::graphemes::nth_prev_grapheme_boundary
at ./helix-core/src/graphemes.rs:37:5
4: helix_core::graphemes::prev_grapheme_boundary
at ./helix-core/src/graphemes.rs:79:5
5: helix_core::graphemes::ensure_grapheme_boundary_prev
at ./helix-core/src/graphemes.rs:194:9
6: helix_core::selection::Range::grapheme_aligned
at ./helix-core/src/selection.rs:247:17
7: helix_core::selection::Selection::ensure_invariants::{{closure}}
at ./helix-core/src/selection.rs:529:28
8: helix_core::selection::Selection::transform
at ./helix-core/src/selection.rs:517:22
9: helix_core::selection::Selection::ensure_invariants
at ./helix-core/src/selection.rs:529:9
10: helix_view::document::Document::apply_impl
at ./helix-view/src/document.rs:653:21
11: helix_view::document::Document::apply
at ./helix-view/src/document.rs:716:23
12: helix_term::commands::increment_impl
at ./helix-term/src/commands.rs:4443:9
13: helix_term::commands::increment
at ./helix-term/src/commands.rs:4355:5
14: helix_term::commands::MappableCommand::execute
at ./helix-term/src/commands.rs:174:41
15: helix_term::ui::editor::EditorView::handle_keymap_event
at ./helix-term/src/ui/editor.rs:704:47
16: helix_term::ui::editor::EditorView::command_mode
at ./helix-term/src/ui/editor.rs:795:17
17: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
at ./helix-term/src/ui/editor.rs:1148:33
18: helix_term::compositor::Compositor::handle_event
at ./helix-term/src/compositor.rs:147:19
19: helix_term::application::Application::handle_terminal_events
at ./helix-term/src/application.rs:363:32
20: helix_term::application::Application::event_loop::{{closure}}
at ./helix-term/src/application.rs:217:21
21: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/future/mod.rs:84:19
22: helix_term::application::Application::run::{{closure}}
at ./helix-term/src/application.rs:720:26
23: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/future/mod.rs:84:19
24: hx::main_impl::{{closure}}
at ./helix-term/src/main.rs:142:30
25: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/future/mod.rs:84:19
26: tokio::park::thread::CachedParkThread::block_on::{{closure}}
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:54
27: tokio::coop::with_budget::{{closure}}
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
28: std::thread::local::LocalKey<T>::try_with
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/thread/local.rs:413:16
29: std::thread::local::LocalKey<T>::with
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/thread/local.rs:389:9
30: tokio::coop::with_budget
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
31: tokio::coop::budget
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
32: tokio::park::thread::CachedParkThread::block_on
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:31
33: tokio::runtime::enter::Enter::block_on
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/enter.rs:151:13
34: tokio::runtime::thread_pool::ThreadPool::block_on
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/mod.rs:73:9
35: tokio::runtime::Runtime::block_on
at /home/gokul/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:477:43
36: hx::main_impl
at ./helix-term/src/main.rs:144:5
37: hx::main
at ./helix-term/src/main.rs:36:21
38: core::ops::function::FnOnce::call_once
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
|
I have narrowed this further to just 49 lines, cutting out the words, symbols, and the year part of the date: |
Ok, I've pushed this to as small a file as I can, just three lines: Edit, full backtrace:
|
It seems to be a problem with changing a -1 to 0 (ctrl-a is increment by one so -1 + 1 = 0) and then calculating the subsequent cursor position; it doesn't have to do anything with dates at all (the original text contained strings like With this text:
put the cursor on the two minuses (
|
Strange. |
Summary
The original summary included a lot of context that isn't related. After some discussion this is what has been found.
If you have a file with the following:
And you enter the following keystrokes:
%
s
-
<enter>
C-a
Helix panics.
This doesn't happen when there is a character, space or empty line after the two lines:
(Helix doesn't panic with the above input on this text)
Here is the backtrace with RUST_BACKTRACE=1:
I also now updated the Helix version to my now current version on this issue because this bug still exists at the time of writing.
Helix log
~/.cache/helix/helix.log
Platform
Linux
Terminal Emulator
alacritty
Helix Version
22.03-105-gcc68fa85
The text was updated successfully, but these errors were encountered: