helix-editor / helix

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

Panic in ropey/src/slice.rs:360:41 in Helix 22.12 #6049

Closed charles-dyfis-net closed 1 year ago

charles-dyfis-net commented 1 year ago

Summary

Alas, I'm not able to reliably reproduce this -- hopefully the stack trace is sufficient to be useful.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Char index out of bounds: char index 2332, Rope/RopeSlice char length 1322', /private/tmp/nix-build-helix-22.12.drv-0/helix-22.12-vendor.tar.gz/ropey/src/slice.rs:360:41
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: helix_core::graphemes::nth_prev_grapheme_boundary
   4: helix_core::selection::Range::grapheme_aligned
   5: helix_core::selection::Selection::ensure_invariants
   6: helix_view::document::Document::set_selection
   7: helix_term::ui::regex_prompt::{{closure}}
   8: <helix_term::ui::prompt::Prompt as helix_term::compositor::Component>::handle_event
   9: helix_term::compositor::Compositor::handle_event
  10: helix_term::application::Application::run::{{closure}}
  11: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  12: tokio::runtime::park::CachedParkThread::block_on
  13: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
  14: tokio::runtime::runtime::Runtime::block_on
  15: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Reproduction Steps

N/A: Unable to reproduce

Helix log

~/.cache/helix/helix.log Unfortunately, there's very little content in `helix.log` in the seconds surrounding the error. (Previously there are several panics from rnix-lsp, but these are from well before the relevant point-in-time, and appear to be from completely different editor sessions). ``` 2023-02-18T16:09:44.509 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 32, character: 0 }, end: Position { line: 32, character: 0 } }, severity: Some(Error), code: Some(String("syntax_error")), code_description: None, source: None, message: "Expecting \";\"", related_information: Some([]), tags: Some([]), data: None } 2023-02-18T16:09:44.510 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 32, character: 0 }, end: Position { line: 32, character: 0 } }, severity: Some(Error), code: Some(String("syntax_error")), code_description: None, source: None, message: "Expecting \"}\"", related_information: Some([]), tags: Some([]), data: None } 2023-02-18T16:09:44.666 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 33, character: 0 }, end: Position { line: 33, character: 0 } }, severity: Some(Error), code: Some(String("syntax_error")), code_description: None, source: None, message: "Expecting \";\"", related_information: Some([]), tags: Some([]), data: None } 2023-02-18T16:09:44.666 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 33, character: 0 }, end: Position { line: 33, character: 0 } }, severity: Some(Error), code: Some(String("syntax_err or")), code_description: None, source: None, message: "Expecting \"}\"", related_information: Some([]), tags: Some([]), data: None } ```

Platform

MacOS 13.1, with Helix installed via Nix (from the nixpkgs unstable channel)

Terminal Emulator

iTerm2 3.4.19

Helix Version

helix 22.12

the-mikedavis commented 1 year ago

We would need a reproduction case to debug this properly but based on the backtrace I think this is https://github.com/helix-editor/helix/issues/5632. I will close in favor of that but feel free to re-open or open a new issue if you find a reproduction case for this.

charles-dyfis-net commented 1 year ago

Looks consistent -- I did indeed have a vertical split when this took place.