From 0a1a6ab89259543e3d68d2e537c74ecf5d8656fe Mon Sep 17 00:00:00 2001 From: lukeflo Date: Tue, 8 Jul 2025 21:11:52 +0200 Subject: fix some tests, default config, help popup --- src/bibiman/entries.rs | 29 ++++++++++++++++++++++++----- src/bibiman/search.rs | 1 + src/config.rs | 10 ++++++++++ src/tui/popup.rs | 4 ++-- 4 files changed, 37 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/bibiman/entries.rs b/src/bibiman/entries.rs index 9b536fd..8f678bc 100644 --- a/src/bibiman/entries.rs +++ b/src/bibiman/entries.rs @@ -131,7 +131,11 @@ impl EntryTable { #[cfg(test)] mod tests { - use crate::bibiman::BibiData; + use crate::{ + bibiman::{bibisetup::BibiRow, BibiData}, + cliargs::CLIArgs, + config::BibiConfig, + }; #[test] fn check_os() { @@ -146,6 +150,7 @@ mod tests { #[test] fn shorten_authors() { + let cfg = BibiConfig::new(&CLIArgs::default()); let mut entry: BibiData = BibiData { id: 1, authors: "Miller, Schmitz, Bernard".to_string(), @@ -161,9 +166,10 @@ mod tests { file_field: false, subtitle: None, notes: None, + symbols: [None, None, None], }; - let entry_vec = BibiData::ref_vec(&mut entry); + let entry_vec = BibiData::ref_vec(&mut entry, &cfg); let mut entry_editors: BibiData = BibiData { id: 2, @@ -180,17 +186,30 @@ mod tests { file_field: false, subtitle: None, notes: None, + symbols: [None, None, None], }; - let entry_vec_editors = BibiData::ref_vec(&mut entry_editors); + let entry_vec_editors = BibiData::ref_vec(&mut entry_editors, &cfg); assert_eq!( entry_vec, - vec!["Miller et al.", "A title", "2000", "article"] + BibiRow { + authors: "Miller et al.", + title: "A title", + year: "2000", + pubtype: "article", + symbols: &[None, None, None] + } ); assert_eq!( entry_vec_editors, - vec!["Miller et al. (ed.)", "A title", "2000", "article"] + BibiRow { + authors: "Miller et al. (ed.)", + title: "A title", + year: "2000", + pubtype: "article", + symbols: &[None, None, None] + } ) } } diff --git a/src/bibiman/search.rs b/src/bibiman/search.rs index 0e32f63..f6679a4 100644 --- a/src/bibiman/search.rs +++ b/src/bibiman/search.rs @@ -138,6 +138,7 @@ mod tests { file_field: true, subtitle: None, notes: None, + symbols: [None, None, None], }; let joined_vec = BibiSearch::convert_to_string(&bibvec); diff --git a/src/config.rs b/src/config.rs index 1f6c619..4e46fdd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -351,6 +351,9 @@ mod tests { [general] pdf_opener = "xdg-open" url_opener = "xdg-open" + note_symbol = "N" + file_symbol = "F" + link_symbol = "L" [colors] main_text_color = "250" @@ -361,8 +364,15 @@ mod tests { confirm_color = "47" warn_color = "124" bar_bg_color = "235" + popup_fg_color = "43" popup_bg_color = "234" selected_row_bg_color = "237" + note_color = "123" + file_color = "209" + link_color = "39" + author_color = "38" + title_color = "37" + year_color = "135" "#, )?; diff --git a/src/tui/popup.rs b/src/tui/popup.rs index 46e4792..4dbf6b6 100644 --- a/src/tui/popup.rs +++ b/src/tui/popup.rs @@ -87,8 +87,8 @@ impl PopupArea { ), ("y: ", "yank/copy citekey of selected entry to clipboard"), ("e: ", "Open editor at selected entry"), - ("o: ", "Open with selected entry associated PDF"), - ("u: ", "Open DOI/URL of selected entry"), + ("o: ", "Open resource attached to selected entry"), + ("n: ", "Create note for selected entry"), ("a: ", "Add new entry"), ("ESC: ", "Reset all lists"), ("Keyword List", "sub"), -- cgit v1.2.3