Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic after typing german umlaut in minibuffer #97

Open
wullewutz opened this issue Jun 28, 2020 · 1 comment
Open

Panic after typing german umlaut in minibuffer #97

wullewutz opened this issue Jun 28, 2020 · 1 comment

Comments

@wullewutz
Copy link

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.

@wullewutz
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant