From 71632fca42977560aaf77dd521b0b6b51319ec17 Mon Sep 17 00:00:00 2001 From: lukeflo Date: Sat, 23 Aug 2025 21:29:35 +0200 Subject: implement a customizable fourth column for `EntryTable` + Now one can select a fourth column to be displayed in the config file + Possible values: journaltitle, organization, institution, publisher, pubtype + Defaults to pubtype --- src/tui/ui.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/tui') diff --git a/src/tui/ui.rs b/src/tui/ui.rs index 69ca058..2180838 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -18,6 +18,7 @@ use std::path::PathBuf; use super::popup::{PopupArea, PopupItem}; +use crate::bibiman::bibisetup::CustomField; use crate::bibiman::entries::EntryTableColumn; use crate::bibiman::{CurrentArea, FormerArea}; use crate::cliargs::CLIArgs; @@ -623,6 +624,15 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec .fg(cfg.colors.main_text_color) .bg(cfg.colors.bar_bg_color); + let custom_col_title: &str = match cfg.general.custom_column { + CustomField::Journaltitle => "Journaltitle", + CustomField::Organization => "Organization", + CustomField::Institution => "Institution", + CustomField::Series => "Series", + CustomField::Publisher => "Publisher", + CustomField::Pubtype => "Pubtype", + }; + let header = Row::new(vec![ Cell::from(Line::from("Res.")).bg(cfg.colors.bar_bg_color), Cell::from( @@ -705,7 +715,7 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec ), ), Cell::from( - Line::from(vec![{ Span::raw("Pubtype") }, { + Line::from(vec![{ Span::raw(custom_col_title) }, { if let Some(EntryTableColumn::Pubtype) = app.bibiman.entry_table.entry_table_sorted_by_col { @@ -786,7 +796,7 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec 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(item.custom_field_value)), ]); // let row = item -- cgit v1.2.3