Skip to content

Commit 08c0923

Browse files
committed
results panel config, new tests
1 parent 65daa7a commit 08c0923

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

.config/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ border_type = "rounded" # https://docs.rs/ratatui/latest/ratatui/widgets/block/e
109109
# Status bar separators (box):
110110
separator_open = ""
111111
separator_close = ""
112-
border_type = "rounded"
113112

114113
[ui.results_panel]
115114
border_type = "rounded"
@@ -120,6 +119,7 @@ size = 50
120119
#header = "{}"
121120
#footer = ""
122121
scrollbar = true
122+
border_type = "rounded"
123123

124124
[ui.remote_control]
125125
# Whether to show channel descriptions in remote control mode

television/channels/prototypes.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ pub struct UiSpec {
382382
#[serde(default)]
383383
pub preview_panel: Option<ui::PreviewPanelConfig>,
384384
#[serde(default)]
385+
pub results_panel: Option<ui::ResultsPanelConfig>,
386+
#[serde(default)]
385387
pub status_bar: Option<ui::StatusBarConfig>,
386388
#[serde(default)]
387389
pub help_panel: Option<ui::HelpPanelConfig>,
@@ -399,6 +401,7 @@ impl From<&crate::config::UiConfig> for UiSpec {
399401
orientation: Some(config.orientation),
400402
input_bar: Some(config.input_bar.clone()),
401403
preview_panel: Some(config.preview_panel.clone()),
404+
results_panel: Some(config.results_panel.clone()),
402405
status_bar: Some(config.status_bar.clone()),
403406
help_panel: Some(config.help_panel.clone()),
404407
remote_control: Some(config.remote_control.clone()),
@@ -409,7 +412,9 @@ impl From<&crate::config::UiConfig> for UiSpec {
409412
#[cfg(test)]
410413
mod tests {
411414
use crate::{
412-
action::Action, config::Binding, event::Key,
415+
action::Action,
416+
config::{Binding, ui::BorderType},
417+
event::Key,
413418
screen::layout::InputPosition,
414419
};
415420

@@ -501,11 +506,16 @@ mod tests {
501506
[ui.input_bar]
502507
position = "bottom"
503508
header = "Input: {}"
509+
border_type = "plain"
504510
505511
[ui.preview_panel]
506512
size = 66
507513
header = "Preview: {}"
508514
footer = "Press 'q' to quit"
515+
border_type = "thick"
516+
517+
[ui.results_panel]
518+
border_type = "none"
509519
510520
[keybindings]
511521
quit = ["esc", "ctrl-c"]
@@ -552,26 +562,19 @@ mod tests {
552562
let input_bar = ui.input_bar.as_ref().unwrap();
553563
assert_eq!(input_bar.position, InputPosition::Bottom);
554564
assert_eq!(input_bar.header.as_ref().unwrap().raw(), "Input: {}");
565+
assert_eq!(input_bar.border_type, BorderType::Plain);
566+
let preview_panel = ui.preview_panel.as_ref().unwrap();
555567
assert_eq!(
556-
ui.preview_panel
557-
.as_ref()
558-
.unwrap()
559-
.header
560-
.as_ref()
561-
.unwrap()
562-
.raw(),
568+
preview_panel.header.as_ref().unwrap().raw(),
563569
"Preview: {}"
564570
);
565571
assert_eq!(
566-
ui.preview_panel
567-
.as_ref()
568-
.unwrap()
569-
.footer
570-
.as_ref()
571-
.unwrap()
572-
.raw(),
572+
preview_panel.footer.as_ref().unwrap().raw(),
573573
"Press 'q' to quit"
574574
);
575+
assert_eq!(preview_panel.border_type, BorderType::Thick);
576+
577+
assert_eq!(ui.results_panel.unwrap().border_type, BorderType::None);
575578

576579
let keybindings = prototype.keybindings.unwrap();
577580
assert_eq!(

television/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ fn apply_ui_overrides(
374374
orientation: None,
375375
input_bar: None,
376376
preview_panel: None,
377+
results_panel: None,
377378
status_bar: None,
378379
help_panel: None,
379380
remote_control: None,
@@ -759,6 +760,7 @@ mod tests {
759760
scrollbar: false,
760761
border_type: BorderType::default(),
761762
}),
763+
results_panel: None,
762764
status_bar: None,
763765
help_panel: None,
764766
remote_control: None,

television/screen/preview.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use crate::{
22
config::ui::{BorderType, PreviewPanelConfig},
3-
previewer::{state::PreviewState, Preview},
3+
previewer::{Preview, state::PreviewState},
44
screen::colors::Colorscheme,
55
utils::strings::{
6-
replace_non_printable, shrink_with_ellipsis, ReplaceNonPrintableConfig, EMPTY_STRING
6+
EMPTY_STRING, ReplaceNonPrintableConfig, replace_non_printable,
7+
shrink_with_ellipsis,
78
},
89
};
910
use anyhow::Result;

0 commit comments

Comments
 (0)