evil-helix icon indicating copy to clipboard operation
evil-helix copied to clipboard

Possible crash when indenting/dedenting on the last line

Open usagi-flow opened this issue 8 months ago • 3 comments

Image

I selected the last line of a file and pressed > (or shift + .)

that causes helix to crash and the error message is as follows:

thread 'main' panicked at helix-core/src/transaction.rs:499:9:
Positions [(5, BeforeSticky)] are out of range for changeset len 4!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Originally posted by @shibahaczix in #80

usagi-flow avatar May 13 '25 19:05 usagi-flow

@shibahaczix Thank you very much for the info and screenshot. I still couldn't reproduce it:

  • Open editor with empty buffer
  • i, (enter), ee, (enter), (escape), v
    • Here, I see what you have in your screenshot Image
  • <, >, <, ...

But it just won't crash.

Could you please post the output of hx --version, and could you please reproduce the bug by starting the editor with RUST_BACKTRACE=1 hx? That'll generate a large stack trace when the editor crashes; you can copy and paste it in this issue.

usagi-flow avatar May 13 '25 19:05 usagi-flow

shiba  ~  21:27  hx --version
evil-helix (3d331218, helix 25.1)

shiba  ~  21:27  RUST_BACKTRACE=1 hx
thread 'main' panicked at helix-core/src/transaction.rs:499:9:
Positions [(5, BeforeSticky)] are out of range for changeset len 4!
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: helix_core::transaction::ChangeSet::update_positions
   3: helix_view::view::View::apply
   4: helix_view::document::Document::append_changes_to_history
   5: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
   6: helix_term::compositor::Compositor::handle_event
   7: hx::main_impl::{{closure}}
   8: tokio::runtime::park::CachedParkThread::block_on
   9: tokio::runtime::context::runtime::enter_runtime
  10: tokio::runtime::runtime::Runtime::block_on
  11: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Also a part of my config:

[keys.select]
"<" = ["save_selection", "unindent", "select_mode", "jump_backward", "shrink_to_line_bounds"]
">" = ["save_selection", "indent", "select_mode", "jump_backward", "extend_to_line_bounds"]

shibahaczix avatar May 13 '25 19:05 shibahaczix

This is unrelated, but the clipboard integration in Helix doesn’t work on Evil-Helix.

shibahaczix avatar May 13 '25 19:05 shibahaczix