diff options
| author | lukeflo | 2025-08-23 21:29:35 +0200 |
|---|---|---|
| committer | lukeflo | 2025-08-23 21:29:35 +0200 |
| commit | 71632fca42977560aaf77dd521b0b6b51319ec17 (patch) | |
| tree | 651d5cbaf8cc94a5eb05c84866b0f05a720ca0f0 /src/tui/ui.rs | |
| parent | 2c1e8342b29b36e09ec90a1cb3d5819c7143273c (diff) | |
| download | bibiman-71632fca42977560aaf77dd521b0b6b51319ec17.tar.gz bibiman-71632fca42977560aaf77dd521b0b6b51319ec17.zip | |
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
Diffstat (limited to 'src/tui/ui.rs')
| -rw-r--r-- | src/tui/ui.rs | 14 |
1 files changed, 12 insertions, 2 deletions
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 |
