mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-25 14:44:39 +02:00
refactor: change canvas macOS check to compile-time (#1184)
This commit is contained in:
parent
c6d322263e
commit
5e0900584b
@ -63,7 +63,6 @@ pub struct Painter {
|
|||||||
height: u16,
|
height: u16,
|
||||||
width: u16,
|
width: u16,
|
||||||
styled_help_text: Vec<Line<'static>>,
|
styled_help_text: Vec<Line<'static>>,
|
||||||
is_mac_os: bool, // TODO: This feels out of place...
|
|
||||||
|
|
||||||
// TODO: Redo this entire thing.
|
// TODO: Redo this entire thing.
|
||||||
row_constraints: Vec<LayoutConstraint>,
|
row_constraints: Vec<LayoutConstraint>,
|
||||||
@ -157,7 +156,6 @@ impl Painter {
|
|||||||
height: 0,
|
height: 0,
|
||||||
width: 0,
|
width: 0,
|
||||||
styled_help_text: Vec::default(),
|
styled_help_text: Vec::default(),
|
||||||
is_mac_os: cfg!(target_os = "macos"),
|
|
||||||
row_constraints,
|
row_constraints,
|
||||||
col_constraints,
|
col_constraints,
|
||||||
col_row_constraints,
|
col_row_constraints,
|
||||||
|
@ -220,10 +220,14 @@ impl Painter {
|
|||||||
|
|
||||||
// TODO: [MOUSE] Mouse support for these in search
|
// TODO: [MOUSE] Mouse support for these in search
|
||||||
// TODO: [MOVEMENT] Movement support for these in search
|
// TODO: [MOVEMENT] Movement support for these in search
|
||||||
let (case, whole, regex) = if self.is_mac_os {
|
let (case, whole, regex) = {
|
||||||
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(target_os = "macos")] {
|
||||||
("Case(F1)", "Whole(F2)", "Regex(F3)")
|
("Case(F1)", "Whole(F2)", "Regex(F3)")
|
||||||
} else {
|
} else {
|
||||||
("Case(Alt+C)", "Whole(Alt+W)", "Regex(Alt+R)")
|
("Case(Alt+C)", "Whole(Alt+W)", "Regex(Alt+R)")
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let option_text = Line::from(vec![
|
let option_text = Line::from(vec![
|
||||||
Span::styled(case, case_style),
|
Span::styled(case, case_style),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user