Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,17 @@ impl<'a> App<'a> {
self.state_dirty = false;

let frame = terminal.get_frame();
current_list!(self).update(frame.area(), &self.view);
current_list!(self).update(
frame.area(),
&self.view,
self.config.show_dividers,
);

let new_visible_objects =
current_list!(self).visible_objects(&frame.area(), &self.view);
let new_visible_objects = current_list!(self).visible_objects(
&frame.area(),
&self.view,
self.config.show_dividers,
);
if new_visible_objects != self.visible_objects {
needs_render = true;
self.visible_objects = new_visible_objects;
Expand Down Expand Up @@ -882,6 +889,7 @@ mod tests {
tabs: vec![TabKind::Playback],
lazy_capture: Default::default(),
filters: Default::default(),
show_dividers: Default::default(),
};

let mut app = App::new(wirehose, event_rx, config);
Expand Down Expand Up @@ -983,6 +991,7 @@ mod tests {
],
lazy_capture: Default::default(),
filters: Default::default(),
show_dividers: Default::default(),
};
let mut app = App::new(&wirehose, event_rx, config);

Expand Down
20 changes: 20 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct Config {
pub peaks: Peaks,
pub char_set: CharSet,
pub theme: Theme,
pub show_dividers: bool,
pub max_volume_percent: f32,
pub enforce_max_volume: bool,
pub keybindings: HashMap<KeyEvent, Action>,
Expand Down Expand Up @@ -64,6 +65,8 @@ struct ConfigFile {
char_set: String,
#[serde(default = "default_theme_name")]
theme: String,
#[serde(default = "default_show_dividers")]
show_dividers: bool,
#[serde(default = "default_max_volume_percent")]
max_volume_percent: Option<f32>,
#[serde(default = "default_enforce_max_volume")]
Expand Down Expand Up @@ -151,6 +154,7 @@ pub struct CharSet {
pub tab_marker_left: String,
pub tab_marker_right: String,
pub list_more: String,
pub divider: String,
pub volume_empty: String,
pub volume_filled: String,
pub meter_left_inactive: String,
Expand Down Expand Up @@ -181,6 +185,7 @@ pub struct Theme {
pub tab_selected: Style,
pub tab_marker: Style,
pub list_more: Style,
pub divider: Style,
pub node_title: Style,
pub node_target: Style,
pub volume: Style,
Expand Down Expand Up @@ -270,6 +275,10 @@ fn default_lazy_capture() -> bool {
false
}

fn default_show_dividers() -> bool {
false
}

impl ConfigFile {
/// Override configuration with command-line arguments.
pub fn apply_opt(&mut self, opt: &Opt) {
Expand Down Expand Up @@ -328,6 +337,14 @@ impl ConfigFile {
if opt.lazy_capture {
self.lazy_capture = true;
}

if opt.no_show_dividers {
self.show_dividers = false;
}

if opt.show_dividers {
self.show_dividers = true;
}
}
}

Expand Down Expand Up @@ -390,6 +407,7 @@ impl TryFrom<ConfigFile> for Config {
enforce_max_volume: config_file.enforce_max_volume,
char_set,
theme,
show_dividers: config_file.show_dividers,
keybindings: config_file.keybindings,
help,
names: config_file.names,
Expand Down Expand Up @@ -469,6 +487,7 @@ pub mod strict {
peaks: Option<Peaks>,
char_set: String,
theme: String,
show_dividers: bool,
max_volume_percent: Option<f32>,
enforce_max_volume: bool,
#[serde(deserialize_with = "keybindings")]
Expand All @@ -493,6 +512,7 @@ pub mod strict {
peaks: strict.peaks,
char_set: strict.char_set,
theme: strict.theme,
show_dividers: strict.show_dividers,
max_volume_percent: strict.max_volume_percent,
enforce_max_volume: strict.enforce_max_volume,
keybindings: strict.keybindings,
Expand Down
5 changes: 5 additions & 0 deletions src/config/char_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct CharSetOverlay {
tab_marker_left: Option<String>,
tab_marker_right: Option<String>,
list_more: Option<String>,
divider: Option<String>,
volume_empty: Option<String>,
volume_filled: Option<String>,
meter_left_inactive: Option<String>,
Expand Down Expand Up @@ -103,6 +104,7 @@ impl TryFrom<CharSetOverlay> for CharSet {
validate_and_set!(tab_marker_left, 1);
validate_and_set!(tab_marker_right, 1);
validate_and_set!(list_more, 0);
validate_and_set!(divider, 1);
validate_and_set!(volume_empty, 1);
validate_and_set!(volume_filled, 1);
validate_and_set!(meter_left_inactive, 1);
Expand Down Expand Up @@ -143,6 +145,7 @@ impl Default for CharSet {
tab_marker_left: String::from("["),
tab_marker_right: String::from("]"),
list_more: String::from("•••"),
divider: String::from("─"),
volume_empty: String::from("╌"),
volume_filled: String::from("━"),
meter_left_inactive: String::from("▮"),
Expand Down Expand Up @@ -184,6 +187,7 @@ impl CharSet {
tab_marker_left: String::from("["),
tab_marker_right: String::from("]"),
list_more: String::from("•••"),
divider: String::from("─"),
volume_empty: String::from("─"),
volume_filled: String::from("━"),
meter_left_inactive: String::from("┃"),
Expand Down Expand Up @@ -215,6 +219,7 @@ impl CharSet {
tab_marker_left: String::from("["),
tab_marker_right: String::from("]"),
list_more: String::from("~~~"),
divider: String::from("-"),
volume_empty: String::from("-"),
volume_filled: String::from("="),
meter_left_inactive: String::from("="),
Expand Down
5 changes: 5 additions & 0 deletions src/config/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct ThemeOverlay {
tab_selected: Option<StyleDef>,
tab_marker: Option<StyleDef>,
list_more: Option<StyleDef>,
divider: Option<StyleDef>,
node_title: Option<StyleDef>,
node_target: Option<StyleDef>,
volume: Option<StyleDef>,
Expand Down Expand Up @@ -96,6 +97,7 @@ impl TryFrom<ThemeOverlay> for Theme {
set!(tab_selected);
set!(tab_marker);
set!(list_more);
set!(divider);
set!(node_title);
set!(node_target);
set!(volume);
Expand Down Expand Up @@ -131,6 +133,7 @@ impl Default for Theme {
tab_selected: Style::default().fg(Color::LightCyan),
tab_marker: Style::default().fg(Color::LightCyan),
list_more: Style::default().fg(Color::DarkGray),
divider: Style::default().fg(Color::DarkGray),
node_title: Style::default(),
node_target: Style::default(),
volume: Style::default(),
Expand Down Expand Up @@ -175,6 +178,7 @@ impl Theme {
tab_selected: Style::default().add_modifier(Modifier::BOLD),
tab_marker: Style::default().add_modifier(Modifier::BOLD),
list_more: Style::default(),
divider: Style::default(),
node_title: Style::default(),
node_target: Style::default(),
volume: Style::default(),
Expand Down Expand Up @@ -208,6 +212,7 @@ impl Theme {
tab_selected: Style::default(),
tab_marker: Style::default(),
list_more: Style::default(),
divider: Style::default(),
node_title: Style::default(),
node_target: Style::default(),
volume: Style::default(),
Expand Down
Loading
Loading