1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
macro_rules! cond_bg {
($dst:ident, $self:ident, $selected:expr, $src:expr) => {
let mut cloned_style;
let $dst = if $selected {
cloned_style = $src.clone();
if let Some(c) = $self.skin.selected_line.get_bg() {
cloned_style.set_bg(c);
}
&cloned_style
} else {
&$src
};
};
}
mod areas;
mod col;
mod crop_writer;
mod displayable_tree;
mod filling;
mod git_status_display;
pub mod flags_display;
pub mod status_line;
mod matched_string;
mod screen;
mod cell_size;
#[cfg(not(any(target_family="windows",target_os="android")))]
mod permissions;
pub use {
areas::Areas,
col::*,
crop_writer::CropWriter,
displayable_tree::DisplayableTree,
filling::*,
git_status_display::GitStatusDisplay,
matched_string::MatchedString,
screen::Screen,
cell_size::*,
};
use {
crate::{
errors::ProgramError,
},
crossterm::{
style::{
Color,
SetBackgroundColor,
},
QueueableCommand,
},
};
#[cfg(not(any(target_family="windows",target_os="android")))]
pub use {
permissions::PermWriter,
};
pub static TAB_REPLACEMENT: &str = " ";
lazy_static! {
pub static ref SPACE_FILLING: Filling = Filling::from_char(' ');
pub static ref BRANCH_FILLING: Filling = Filling::from_char('─');
}
pub const WIDE_STATUS: bool = true;
pub type W = std::io::BufWriter<std::io::Stderr>;
pub fn writer() -> W {
std::io::BufWriter::new(std::io::stderr())
}
pub fn fill_bg(
w: &mut W,
len: usize,
bg: Color,
) -> Result<(), ProgramError> {
w.queue(SetBackgroundColor(bg))?;
SPACE_FILLING.queue_unstyled(w, len)?;
Ok(())
}