Fix bug with short alphabets

This commit is contained in:
Ferran Basora 2019-02-25 23:49:37 +00:00
parent e52cdad091
commit 02eacd4144
2 changed files with 2 additions and 2 deletions

View File

@ -104,7 +104,7 @@ fn main() {
let mut typed_hint: String = "".to_owned();
let matches = state.matches(reverse, unique);
let longest_hint = matches.last().unwrap().hint.clone().unwrap().len();
let longest_hint = matches.iter().filter(|&m| m.hint.clone().is_some()).last().unwrap().hint.clone().expect("Unknown hint").len();
loop {
let mut selected = matches.last();

View File

@ -57,7 +57,7 @@ impl<'a> State<'a> {
hint: None
});
chunk = chunk.get(first_match.end()..).unwrap();
chunk = chunk.get(first_match.end()..).expect("Unknown chunk");
offset = offset + first_match.end() as i32;
} else {
break;