zee-editor/zee

Crash on saving

Pluriscient opened this issue · 3 comments

Upon saving a small .md file with C-x C-s, zee crashed with the following:

Internal zee error -- this is a bug, please submit an issue at https://github.com/zee-editor/zee
Thread 'main' panicked at 'byte_slice(): Byte range out of bounds: byte range 0..163, Rope/RopeSlice byte length 160', /home/pluriscient/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.5.0/src/rope.rs:973:23
   0: zee::panicking::save_panic_backtrace_hook
   1: std::panicking::rust_panic_with_hook
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:702:17
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:588:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:138:18
   4: rust_begin_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
   5: core::panicking::panic_fmt
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
   6: ropey::rope::Rope::byte_slice
   7: <ComponentT as zi::component::template::Renderable>::view
   8: zi_term::Crossterm<PainterT>::run_event_loop
   9: zee::start_editor
  10: std::panic::catch_unwind
  11: zee::panicking::print_panic_after_unwind
  12: std::sys_common::backtrace::__rust_begin_short_backtrace
  13: std::rt::lang_start::{{closure}}
  14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:280:13
      std::panicking::try::do_call
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128:48
      std::panicking::try::do_call
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137:14
      std::rt::lang_start_internal
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128:20
  15: main
  16: __libc_start_main
  17: _start

Thank you for opening the issue -- I will investigate and see I can reproduce this myself.

Might this issue be related to the "Colour Panic" described in #42? Since even this repository's README triggers a colourisation failure, the described bug might originate from such a "Colour Panic". Line 8 of the crash report seems to be related to this.

@Pluriscient, do you remember the text being highlighted with non-uniform colours for sections and headlines?

I don't think I noticed, but my memory of the incident has faded by now.