mirror of
https://github.com/notohh/rustlings.git
synced 2024-12-17 22:58:08 -05:00
Remove the footer separators
This commit is contained in:
parent
75a38fa38b
commit
86fc573d7a
1 changed files with 2 additions and 14 deletions
|
@ -43,7 +43,6 @@ pub struct ListState<'a> {
|
||||||
filter: Filter,
|
filter: Filter,
|
||||||
term_width: u16,
|
term_width: u16,
|
||||||
term_height: u16,
|
term_height: u16,
|
||||||
separator_line: Vec<u8>,
|
|
||||||
show_footer: bool,
|
show_footer: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +75,6 @@ impl<'a> ListState<'a> {
|
||||||
// Set by `set_term_size`
|
// Set by `set_term_size`
|
||||||
term_width: 0,
|
term_width: 0,
|
||||||
term_height: 0,
|
term_height: 0,
|
||||||
separator_line: Vec::new(),
|
|
||||||
show_footer: true,
|
show_footer: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,14 +93,10 @@ impl<'a> ListState<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let header_height = 1;
|
let header_height = 1;
|
||||||
// 2 separators, 1 progress bar, 2 footer message lines.
|
// 1 progress bar, 2 footer message lines.
|
||||||
let footer_height = 5;
|
let footer_height = 3;
|
||||||
self.show_footer = height > header_height + footer_height;
|
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(
|
self.scroll_state.set_max_n_rows_to_display(
|
||||||
height.saturating_sub(header_height + u16::from(self.show_footer) * footer_height)
|
height.saturating_sub(header_height + u16::from(self.show_footer) * footer_height)
|
||||||
as usize,
|
as usize,
|
||||||
|
@ -202,9 +196,6 @@ impl<'a> ListState<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.show_footer {
|
if self.show_footer {
|
||||||
stdout.write_all(&self.separator_line)?;
|
|
||||||
next_ln(stdout)?;
|
|
||||||
|
|
||||||
progress_bar(
|
progress_bar(
|
||||||
&mut MaxLenWriter::new(stdout, self.term_width as usize),
|
&mut MaxLenWriter::new(stdout, self.term_width as usize),
|
||||||
self.app_state.n_done(),
|
self.app_state.n_done(),
|
||||||
|
@ -213,9 +204,6 @@ impl<'a> ListState<'a> {
|
||||||
)?;
|
)?;
|
||||||
next_ln(stdout)?;
|
next_ln(stdout)?;
|
||||||
|
|
||||||
stdout.write_all(&self.separator_line)?;
|
|
||||||
next_ln(stdout)?;
|
|
||||||
|
|
||||||
let mut writer = MaxLenWriter::new(stdout, self.term_width as usize);
|
let mut writer = MaxLenWriter::new(stdout, self.term_width as usize);
|
||||||
if self.message.is_empty() {
|
if self.message.is_empty() {
|
||||||
// Help footer message
|
// Help footer message
|
||||||
|
|
Loading…
Reference in a new issue