mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 13:52:55 +03:00
quickselect: refine out of bounds case
I now understand that it is simply because the number of matches is too large to be represented by a two character string in the selected alphabet.
This commit is contained in:
parent
d25580d10f
commit
3a5f6f94a6
@ -109,6 +109,14 @@ mod alphabet_test {
|
||||
assert_eq!(compute_labels_for_alphabet("abcd", 3), vec!["a", "b", "c"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn more_matches_than_alphabet_can_represent() {
|
||||
assert_eq!(
|
||||
compute_labels_for_alphabet("asdfqwerzxcvjklmiuopghtybn", 792).len(),
|
||||
676
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn composed_single() {
|
||||
assert_eq!(
|
||||
@ -573,18 +581,11 @@ impl QuickSelectRenderable {
|
||||
let label = match labels.get(label_index) {
|
||||
Some(l) => l,
|
||||
None => {
|
||||
log::error!(
|
||||
"match_id {} has label_index {} which is out of \
|
||||
bounds of the number of labels {} produced for {} \
|
||||
unique results",
|
||||
res.match_id,
|
||||
label_index,
|
||||
labels.len(),
|
||||
uniq_results.len()
|
||||
);
|
||||
log::error!("labels = {:?}", labels);
|
||||
log::error!("uniq_results = {:?}", uniq_results);
|
||||
log::error!("res = {:?}", res);
|
||||
// There are more result candidates than the alphabet
|
||||
// can support, so we skip this one and keep looking:
|
||||
// we may still have matches that have an assigned
|
||||
// label, so we keep going rather than breaking
|
||||
// out of the loop.
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user