diff options
| author | lukeflo | 2025-06-30 15:45:14 +0200 |
|---|---|---|
| committer | lukeflo | 2025-06-30 15:45:14 +0200 |
| commit | 614a20a12138f6691f8472b8c8657cf62b6730fb (patch) | |
| tree | a14ec81b3b36f3759f277205693cd4b478b0afed /src/tui/ui.rs | |
| parent | 1b79ba0fb9f4a1d96c0de1fbf6ab42d8e1b0873c (diff) | |
| download | bibiman-614a20a12138f6691f8472b8c8657cf62b6730fb.tar.gz bibiman-614a20a12138f6691f8472b8c8657cf62b6730fb.zip | |
implemented symbols for attachements
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) |
