curlpipe / ox

An independent Rust text editor that runs in your terminal!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panicked at 'index out of bounds: the len is 0 but the index is 0', src/document.rs:385:21

jdelgadoalfonso opened this issue · comments

Describe the bug
Edit an empty buffer causes a panic.

To Reproduce
Steps to reproduce the behavior:

  1. Execute ox with no parameters.
  2. Press backspace key twice.
  3. The application panics showing
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', src/document.rs:385:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    713693 abort (core dumped)  ox

Expected behavior
Control an empty buffer and do not panic.

Screenshots
ox

Desktop (please complete the following information):

commented

duplicate