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

Use console::measure_text_width to generate size_vec in select #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/prompts/multi_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ impl<'a> MultiSelect<'a> {
.flat_map(|i| i.split('\n'))
.collect::<Vec<_>>()
{
let size = &items.len();
size_vec.push(*size);
let size = console::measure_text_width(items);
size_vec.push(size);
}

let mut checked: Vec<bool> = self.defaults.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/prompts/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ impl<'a> Select<'a> {
.flat_map(|i| i.split('\n'))
.collect::<Vec<_>>()
{
let size = &items.len();
size_vec.push(*size);
let size = console::measure_text_width(items);
size_vec.push(size);
}

loop {
Expand Down
4 changes: 2 additions & 2 deletions src/prompts/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ impl<'a> Sort<'a> {
let mut size_vec = Vec::new();

for items in self.items.iter().as_slice() {
let size = &items.len();
size_vec.push(*size);
let size = console::measure_text_width(items);
size_vec.push(size);
}

let mut order: Vec<_> = (0..self.items.len()).collect();
Expand Down