When an annotation contains non-ASCII text (eg Cyrillic), opening the annotations list with I can panic with byte index 40 is not a char boundary
This appears to happen when the annotation preview is truncated for display.
Steps to reproduce
- Open any diff in lumen
- Press i to create a file annotation
- Paste this:
123456789012345678901234567890123456789б
- Save with Enter
- Press I to open the annotations list
Result: lumen crashes with a panic like:
byte index 40 is not a char boundary; it is inside 'б' (bytes 39..41)
of `123456789012345678901234567890123456789б`
stack backtrace:
0: <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::sys::backtrace::BacktraceLock::print
4: std::panicking::panic_with_hook
5: std::panicking::panic_handler::{{closure}}
6: std::sys::backtrace::__rust_end_short_backtrace
7: __rustc[d9b87f19e823c0ef]::rust_begin_unwind
8: core::panicking::panic_fmt
9: core::str::slice_error_fail_rt
10: core::str::slice_error_fail
11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
12: lumen::command::diff::app::run_app_internal
13: lumen::command::diff::run_diff_ui
14: lumen::main
15: std::sys::backtrace::__rust_begin_short_backtrace
16: _main
When an annotation contains non-ASCII text (eg Cyrillic), opening the annotations list with
Ican panic withbyte index 40 is not a char boundaryThis appears to happen when the annotation preview is truncated for display.
Steps to reproduce
123456789012345678901234567890123456789бResult: lumen crashes with a panic like: