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"]);
|
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]
|
#[test]
|
||||||
fn composed_single() {
|
fn composed_single() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -573,18 +581,11 @@ impl QuickSelectRenderable {
|
|||||||
let label = match labels.get(label_index) {
|
let label = match labels.get(label_index) {
|
||||||
Some(l) => l,
|
Some(l) => l,
|
||||||
None => {
|
None => {
|
||||||
log::error!(
|
// There are more result candidates than the alphabet
|
||||||
"match_id {} has label_index {} which is out of \
|
// can support, so we skip this one and keep looking:
|
||||||
bounds of the number of labels {} produced for {} \
|
// we may still have matches that have an assigned
|
||||||
unique results",
|
// label, so we keep going rather than breaking
|
||||||
res.match_id,
|
// out of the loop.
|
||||||
label_index,
|
|
||||||
labels.len(),
|
|
||||||
uniq_results.len()
|
|
||||||
);
|
|
||||||
log::error!("labels = {:?}", labels);
|
|
||||||
log::error!("uniq_results = {:?}", uniq_results);
|
|
||||||
log::error!("res = {:?}", res);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user