Merge branch 'rust-lang:main' into main

This commit is contained in:
Adhyan H. Patel
2024-09-01 19:57:35 -05:00
committed by GitHub
co-authored by GitHub
2 changed files with 9 additions and 21 deletions
+2 -14
View File
@@ -43,7 +43,6 @@ pub struct ListState<'a> {
filter: Filter,
term_width: u16,
term_height: u16,
separator_line: Vec<u8>,
show_footer: bool,
pub search_query: String,
}
@@ -77,7 +76,6 @@ impl<'a> ListState<'a> {
// Set by `set_term_size`
term_width: 0,
term_height: 0,
separator_line: Vec::new(),
show_footer: true,
search_query: String::new(),
};
@@ -97,14 +95,10 @@ impl<'a> ListState<'a> {
}
let header_height = 1;
// 2 separators, 1 progress bar, 2 footer message lines.
let footer_height = 5;
// 1 progress bar, 2 footer message lines.
let footer_height = 3;
self.show_footer = height > header_height + footer_height;
if self.show_footer {
self.separator_line = "".as_bytes().repeat(width as usize);
}
self.scroll_state.set_max_n_rows_to_display(
height.saturating_sub(header_height + u16::from(self.show_footer) * footer_height)
as usize,
@@ -204,9 +198,6 @@ impl<'a> ListState<'a> {
}
if self.show_footer {
stdout.write_all(&self.separator_line)?;
next_ln(stdout)?;
progress_bar(
&mut MaxLenWriter::new(stdout, self.term_width as usize),
self.app_state.n_done(),
@@ -215,9 +206,6 @@ impl<'a> ListState<'a> {
)?;
next_ln(stdout)?;
stdout.write_all(&self.separator_line)?;
next_ln(stdout)?;
let mut writer = MaxLenWriter::new(stdout, self.term_width as usize);
if self.message.is_empty() {
// Help footer message