helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
34.01k stars 2.51k forks source link

Panic while editing #233

Closed pickfire closed 3 years ago

pickfire commented 3 years ago

Reproduction steps

I was editing helix code itself but panics suddenly. I don't remember which edit am I doing but I face this a few times. ``` thread 'main' panicked at 'assertion failed: self.len_after == other.len', helix-core/src/transaction.rs:128:9 stack backtrace: 0: rust_begin_unwind at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:493:5 1: core::panicking::panic_fmt at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:92:14 2: core::panicking::panic at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:50:5 3: helix_core::transaction::ChangeSet::compose at ./helix-core/src/transaction.rs:128:9 4: helix_view::document::Document::apply::{{closure}} at ./helix-view/src/document.rs:385:17 5: helix_view::document::take_with::{{closure}} at ./helix-view/src/document.rs:89:68 6: as core::ops::function::FnOnce<()>>::call_once at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:344:9 7: std::panicking::try::do_call at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40 8: __rust_try 9: std::panicking::try at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19 10: std::panic::catch_unwind at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:431:14 11: helix_view::document::take_with at ./helix-view/src/document.rs:89:21 12: helix_view::document::Document::apply at ./helix-view/src/document.rs:384:13 13: helix_term::commands::_delete_selection at ./helix-term/src/commands.rs:817:5 14: helix_term::commands::change_selection at ./helix-term/src/commands.rs:834:5 15: helix_term::ui::editor::EditorView::command_mode at ./helix-term/src/ui/editor.rs:553:21 16: ::handle_event at ./helix-term/src/ui/editor.rs:641:33 17: helix_term::compositor::Compositor::handle_event at ./helix-term/src/compositor.rs:112:19 18: helix_term::application::Application::handle_terminal_events at ./helix-term/src/application.rs:145:32 19: helix_term::application::Application::event_loop::{{closure}} at ./helix-term/src/application.rs:109:21 20: as core::future::future::Future>::poll at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 21: helix_term::application::Application::run::{{closure}} at ./helix-term/src/application.rs:331:9 22: as core::future::future::Future>::poll at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 23: hx::main::{{closure}} at ./helix-term/src/main.rs:96:5 24: as core::future::future::Future>::poll at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 25: tokio::park::thread::CachedParkThread::block_on::{{closure}} at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/park/thread.rs:263:54 26: tokio::coop::with_budget::{{closure}} at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/coop.rs:106:9 27: std::thread::local::LocalKey::try_with at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16 28: std::thread::local::LocalKey::with at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9 29: tokio::coop::with_budget at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/coop.rs:99:5 30: tokio::coop::budget at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/coop.rs:76:5 31: tokio::park::thread::CachedParkThread::block_on at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/park/thread.rs:263:31 32: tokio::runtime::enter::Enter::block_on at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/runtime/enter.rs:151:13 33: tokio::runtime::thread_pool::ThreadPool::block_on at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/runtime/thread_pool/mod.rs:71:9 34: tokio::runtime::Runtime::block_on at /home/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.6.1/src/runtime/mod.rs:452:43 35: hx::main at ./helix-term/src/main.rs:98:5 36: core::ops::function::FnOnce::call_once at /home/ivan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5 ``` ### Environment - Platform: arch linux - Helix version: v0.0.10-63-g45793d7 (should say `git describe dirty` in comment because I have some changes to picker)
~/.cache/helix/helix.log ``` 2021-06-12T17:54:21.393 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T18:20:28.659 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T18:20:45.081 helix_term::ui::markdown [WARN] code Borrowed("KeyEvent::F(1)") 2021-06-12T18:20:45.231 helix_term::ui::markdown [WARN] code Borrowed("KeyEvent::Char(\'c\')") 2021-06-12T18:20:45.231 helix_term::ui::markdown [WARN] code Borrowed("c") 2021-06-12T18:20:45.884 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:45.884 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:45.884 helix_term::ui::markdown [WARN] code Borrowed("==") 2021-06-12T18:20:46.089 helix_term::ui::markdown [WARN] code Borrowed("!=") 2021-06-12T18:20:46.223 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:46.224 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:46.369 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:46.369 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:46.369 helix_term::ui::markdown [WARN] code Borrowed("<") 2021-06-12T18:20:46.516 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:46.516 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:46.516 helix_term::ui::markdown [WARN] code Borrowed("<=") 2021-06-12T18:20:46.724 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:46.724 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:46.724 helix_term::ui::markdown [WARN] code Borrowed(">") 2021-06-12T18:20:46.833 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:46.833 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:46.833 helix_term::ui::markdown [WARN] code Borrowed(">=") 2021-06-12T18:20:47.263 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:47.263 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:47.263 helix_term::ui::markdown [WARN] code Borrowed(">=") 2021-06-12T18:20:47.409 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:47.409 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:47.409 helix_term::ui::markdown [WARN] code Borrowed(">") 2021-06-12T18:20:47.449 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:47.450 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:47.450 helix_term::ui::markdown [WARN] code Borrowed("<=") 2021-06-12T18:20:47.490 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:47.490 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:47.490 helix_term::ui::markdown [WARN] code Borrowed("<") 2021-06-12T18:20:47.532 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:47.532 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:47.573 helix_term::ui::markdown [WARN] code Borrowed("!=") 2021-06-12T18:20:47.612 helix_term::ui::markdown [WARN] code Borrowed("self") 2021-06-12T18:20:47.612 helix_term::ui::markdown [WARN] code Borrowed("other") 2021-06-12T18:20:47.612 helix_term::ui::markdown [WARN] code Borrowed("==") 2021-06-12T18:20:48.007 helix_term::ui::markdown [WARN] code Borrowed("KeyEvent::Char(\'c\')") 2021-06-12T18:20:48.007 helix_term::ui::markdown [WARN] code Borrowed("c") 2021-06-12T18:20:48.175 helix_term::ui::markdown [WARN] code Borrowed("KeyEvent::F(1)") 2021-06-12T18:30:37.727 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T18:30:58.381 helix_term::ui::picker [ERROR] [122, 0, 3, 39, 43, 62, 85, 93, 99, 106, 119, 124, 131, 133, 135, 137, 146, 47] 2021-06-12T19:24:10.358 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:24:11.844 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:24:17.690 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:24:19.773 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:29:52.872 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:30:48.192 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:34:05.313 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:38:12.682 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:38:12.682 helix_lsp::transport [ERROR] <- Server error: content modified 2021-06-12T19:39:10.505 helix_lsp::transport [ERROR] <- Server error: content modified ```
archseer commented 3 years ago

Could it be unicode issues still? The document length doesn't match the transaction

pickfire commented 3 years ago

Probably no since this part of source code (picker.rs) shouldn't have any unicode. I was using debug mode.

kirawi commented 3 years ago

Does this still happen?

pickfire commented 3 years ago

No, let me close it.