mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
bug: fix side borders in basic mode (#1110)
Seems like I broke this when migrating from tui-rs to ratatui. This just uses explicit enum variants to set my side borders and a test to try and make sure this doesn't happen again.
This commit is contained in:
parent
3618449d42
commit
8b81dfba47
@ -1,4 +1,5 @@
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
use tui::widgets::Borders;
|
||||||
|
|
||||||
use crate::options::ConfigColours;
|
use crate::options::ConfigColours;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ pub const TABLE_GAP_HEIGHT_LIMIT: u16 = 7;
|
|||||||
pub const TIME_LABEL_HEIGHT_LIMIT: u16 = 7;
|
pub const TIME_LABEL_HEIGHT_LIMIT: u16 = 7;
|
||||||
|
|
||||||
// Side borders
|
// Side borders
|
||||||
pub const SIDE_BORDERS: tui::widgets::Borders = tui::widgets::Borders::from_bits_truncate(20);
|
pub const SIDE_BORDERS: Borders = Borders::LEFT.union(Borders::RIGHT);
|
||||||
pub static DEFAULT_TEXT_STYLE: Lazy<tui::style::Style> =
|
pub static DEFAULT_TEXT_STYLE: Lazy<tui::style::Style> =
|
||||||
Lazy::new(|| tui::style::Style::default().fg(tui::style::Color::Gray));
|
Lazy::new(|| tui::style::Style::default().fg(tui::style::Color::Gray));
|
||||||
pub static DEFAULT_HEADER_STYLE: Lazy<tui::style::Style> =
|
pub static DEFAULT_HEADER_STYLE: Lazy<tui::style::Style> =
|
||||||
@ -738,4 +739,14 @@ mod test {
|
|||||||
"the two should be equal, or this test should be updated"
|
"the two should be equal, or this test should be updated"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This test exists because previously, [`SIDE_BORDERS`] was set incorrectly after I moved from
|
||||||
|
/// tui-rs to ratatui.
|
||||||
|
#[test]
|
||||||
|
fn assert_side_border_bits_match() {
|
||||||
|
assert_eq!(
|
||||||
|
SIDE_BORDERS,
|
||||||
|
Borders::ALL.difference(Borders::TOP.union(Borders::BOTTOM))
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user