Index out of bounds error
Describe the bug ox crashes with an index out of bounds error, when pressing backspace in an empty file.
To Reproduce Steps to reproduce the behavior:
- run
ox - press backspace twice
- error prints to std out and ox quits
Expected behavior Ox does not crash when pressing backspace in an empty file
Screenshots
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', src/document.rs:385:21
stack backtrace:
0: 0x55c15ffc3273 -
1: 0x55c15ff4611c -
2: 0x55c15ffc28d6 -
3: 0x55c15ffc22ca -
4: 0x55c15ffc1b97 -
5: 0x55c15ffc182a -
6: 0x55c15ffc17f4 -
7: 0x55c15ffc17ad -
8: 0x55c15ff438e0 -
9: 0x55c15ff43771 -
10: 0x55c15fed529c -
11: 0x55c15fee6784 -
12: 0x55c15fea7043 -
13: 0x55c15fef0d55 -
14: 0x7fb19de50152 - __libc_start_main
15: 0x55c15fea506e -
16: 0x0 -

Desktop (please complete the following information):
- OS: Arch Linux, latest, kernel 5.9
I've tested it on the master branch and found that it's working fine, no index out of bounds found.
- OS: Manjaro, kernel 5.4.x
I installed the version from the AUR, and I see the issue about it being out of date, so maybe this has been fixed recently?
There are several problems with this editor at the moment and I am starting to see a pattern
- Distribution - There are so many versions of Ox on different packaging systems and it's quite hard to keep up
- Panics - I have failed to test thoroughly enough for these and Ox lacks unit tests, these are also mainly caused by the configuration file.
- Missing features - Some features are quite large and would require a total rewrite of Ox itself.
I'm currently thinking up solutions to each of these problems and I'm currently building a Version 0.3.0 of the editor that I'm building from the ground up. I have created this version with several improvements over the 0.2.* codebase:
- I'm looking into Github actions and teaching myself how to use all these different package managers to ensure that all copies are up to date.
- I've split up the editor into a back end and front end, this allows me to write tests and also design the editor without repeating myself due to the code being cleaner and easier for me to read, therefore allowing me to quickly implement features and patch things because I can isolate them into the front or back end instead of them being fused together. I've already implemented a special test that checks for panics and written my code in a panic-resistant fashion (I've really improved my Rust knowledge over the past few months).
- I'm writing a proper language (Oxa is way too buggy) similar to that of Vimscript and elisp where one can configure and write plugins for Ox. (I've been keen to learn proper lexing & parsing techniques and this is a perfect opportunity)
I have no ETA but I'm making hasty progress with this version and I know that it will create a better experience.
I will also update the AUR package to the latest version now. (forgive me)
I'm writing a proper language (Oxa is way too buggy) similar to that of Vimscript and elisp where one can configure and write plugins for Ox. (I've been keen to learn proper lexing & parsing techniques and this is a perfect opportunity)
why not just use an existing programming language like lua?