diff options
Diffstat (limited to 'src/tui/ui.rs')
| -rw-r--r-- | src/tui/ui.rs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/tui/ui.rs b/src/tui/ui.rs index 970a71d..5904f88 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -701,25 +701,24 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec .map(|(_i, data)| { let item = data.ref_vec(cfg); + let mut symbol_vec = vec![]; + + if let Some(f) = &item.symbols[0] { + symbol_vec.push(Span::styled(f, Style::new().fg(cfg.colors.file_color))); + } + if let Some(l) = &item.symbols[1] { + symbol_vec.push(Span::styled(l, Style::new().fg(cfg.colors.link_color))); + } + if let Some(n) = &item.symbols[2] { + symbol_vec.push(Span::styled(n, Style::new().fg(cfg.colors.note_color))) + } + let row = Row::new(vec![ Cell::from(Line::from(item.authors)), Cell::from(Line::from(item.title)), Cell::from(Line::from(item.year)), Cell::from(Line::from(item.pubtype)), - Cell::from(Line::from(vec![ - Span::styled( - item.symbols[0].clone(), - Style::new().fg(cfg.colors.file_color), - ), - Span::styled( - item.symbols[1].clone(), - Style::new().fg(cfg.colors.link_color), - ), - Span::styled( - item.symbols[2].clone(), - Style::new().fg(cfg.colors.note_color), - ), - ])), + Cell::from(Line::from(symbol_vec)), ]); // let row = item @@ -751,7 +750,12 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec }, ), Constraint::Percentage(10), - Constraint::Length(4), + Constraint::Length( + (cfg.general.file_symbol.chars().count() + + cfg.general.link_symbol.chars().count() + + cfg.general.note_symbol.chars().count() + + 1) as u16, + ), ], ) .block(block) |
