1 //! This module is where is defined whether broot
2 //! writes on stdout, on stderr or elsewhere. It also provides helper
3 //! structs for io.
4
5 /// declare a style named `$dst` which is usually a reference to the `$src`
6 /// skin but, in case `selected` is true, is a clone with background changed
7 /// to the one of selected lines.
8 #[macro_export]
9 macro_rules! cond_bg {
10 ($dst:ident, $self:ident, $selected:expr, $src:expr) => {
11 let mut cloned_style;
12 let $dst = if $selected {
13 cloned_style = $src.clone();
14 if let Some(c) = $self.skin.selected_line.get_bg() {
15 cloned_style.set_bg(c);
16 }
17 &cloned_style
18 } else {
19 &$src
20 };
21 };
22 }
23
24 mod areas;
25 mod col;
26 mod displayable_tree;
27 mod git_status_display;
28 pub mod flags_display;
29 pub mod status_line;
30 mod matched_string;
31 mod screen;
32 mod cell_size;
33
34 #[cfg(not(any(target_family="windows",target_os="android")))]
35 mod permissions;
36
37 pub use {
38 areas::Areas,
39 col::*,
40 cond_bg,
41 displayable_tree::DisplayableTree,
42 git_status_display::GitStatusDisplay,
43 matched_string::MatchedString,
44 screen::Screen,
45 cell_size::*,
46 };
47 use {
48 once_cell::sync::Lazy,
49 termimad::*,
50 };
51
52 #[cfg(not(any(target_family="windows",target_os="android")))]
53 pub use {
54 permissions::PermWriter,
55 };
56
57 pub static BRANCH_FILLING: Lazy<Filling> = Lazy::new(|| { Filling::from_char('─') });
58
59 /// if true then the status of a panel covers the whole width
60 /// of the terminal (over the other panels)
61 pub const WIDE_STATUS: bool = true;
62
63 /// the type used by all GUI writing functions
64 pub type W = std::io::BufWriter<std::io::Stderr>;
65
66 /// return the writer used by the application
writer() -> W67 pub fn writer() -> W {
68 std::io::BufWriter::new(std::io::stderr())
69 }
70