rabite0 / hunter

The fastest file manager in the galaxy!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic after typing german umlaut in minibuffer

wullewutz opened this issue · comments

Hunter panics on the second input character typed into the minibuffer after a german umlaut e.g. "ü".
For example:

  1. Start a search in current dir
  2. Type üb (<-or copy this string if no german keyboard layout available)
  3. 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 (355d9a3) 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?