From 2594cf34dcf2f04f398dab7b6ecae364eb4c7d17 Mon Sep 17 00:00:00 2001 From: lukeflo Date: Fri, 4 Jul 2025 13:56:55 +0200 Subject: impl `PopupItem` enum, adapt ui: include colors --- src/tui/ui.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/tui/ui.rs') 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) -- cgit v1.2.3