aboutsummaryrefslogtreecommitdiff
path: root/src/tui/ui.rs
diff options
context:
space:
mode:
authorlukeflo2025-07-04 13:56:55 +0200
committerlukeflo2025-07-04 13:56:55 +0200
commit2594cf34dcf2f04f398dab7b6ecae364eb4c7d17 (patch)
tree71ec0170052805eeaa9682541f372a2de892defc /src/tui/ui.rs
parent61b22382e0979f756538215047bafd30866ccf1e (diff)
downloadbibiman-2594cf34dcf2f04f398dab7b6ecae364eb4c7d17.tar.gz
bibiman-2594cf34dcf2f04f398dab7b6ecae364eb4c7d17.zip
impl `PopupItem` enum, adapt ui: include colors
Diffstat (limited to 'src/tui/ui.rs')
-rw-r--r--src/tui/ui.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tui/ui.rs b/src/tui/ui.rs
index be53f61..2c30154 100644
--- a/src/tui/ui.rs
+++ b/src/tui/ui.rs
@@ -17,7 +17,7 @@
use std::path::PathBuf;
-use super::popup::PopupArea;
+use super::popup::{PopupArea, PopupItem};
use crate::bibiman::entries::EntryTableColumn;
use crate::bibiman::{CurrentArea, FormerArea};
use crate::cliargs::CLIArgs;
@@ -280,9 +280,17 @@ pub fn render_popup(app: &mut App, cfg: &BibiConfig, frame: &mut Frame) {
.popup_list
.iter()
.map(
- |(mes, obj)| {
+ |(mes, obj, i)| {
+ let style = match i {
+ PopupItem::Bibfile => Style::new().fg(cfg.colors.entry_color),
+ PopupItem::Entryfile => Style::new().fg(cfg.colors.file_color),
+ PopupItem::Notefile => Style::new().fg(cfg.colors.note_color),
+ PopupItem::Link => Style::new().fg(cfg.colors.link_color),
+ PopupItem::Default => Style::new(),
+ PopupItem::None => Style::new(),
+ };
ListItem::from(Line::from(vec![
- Span::styled(mes, Style::new().bold()),
+ Span::styled(mes, style.bold()),
Span::raw(obj),
]))
}, // ListItem::from(mes.to_owned() + obj)
@@ -333,7 +341,7 @@ pub fn render_popup(app: &mut App, cfg: &BibiConfig, frame: &mut Frame) {
.popup_area
.popup_list
.iter()
- .max_by(|(mes, obj), (m, o)| {
+ .max_by(|(mes, obj, _ik), (m, o, _i)| {
let x = mes.chars().count() + obj.chars().count();
let y = m.chars().count() + o.chars().count();
x.cmp(&y)