hunter
hunter copied to clipboard
Panic after typing german umlaut in minibuffer
Hunter panics on the second input character typed into the minibuffer after a german umlaut e.g. "ü". For example:
- Start a search in current dir
- Type üb (<-or copy this string if no german keyboard layout available)
- Panic with message:
thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /rustc/ff5b446d2fdbd898bc97a751f2f72858de185cf1/src/libcore/macros/mod.rs:10:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Reason is probably the cursor positioning/indexing in minibuffer.rs. I'm on current master (355d9a3101f6d8dc375807de79e368602f1cb87d) using 1.46.0-nightly. Happens in alacritty as well as xterm.
Typing ü adds two bytes to self.input in minibuffer.rs instead of just one here (minibuffer.rs:521):
InsertChar(ch) => {
self.input.insert(self.position, *ch);
self.position += 1;
}
Since position is only incremented by one, the next character input is not at a char boundary anymore leading insert() to panic. Not so easy to fix, i suspect... Have you considered using rustyline for minibuffer input?