aboutsummaryrefslogtreecommitdiff
path: root/src/bibiman.rs
diff options
context:
space:
mode:
authorlukeflo2025-07-05 22:55:46 +0200
committerlukeflo2025-07-05 22:55:46 +0200
commite2b4e12cf1ce15a26172ac8f2166c5e02ca89351 (patch)
tree111dc459d1d022cf61f7b55c29962a162f381aaa /src/bibiman.rs
parent19672076cf58e12355074b791a55d1d0cddfc7e4 (diff)
downloadbibiman-e2b4e12cf1ce15a26172ac8f2166c5e02ca89351.tar.gz
bibiman-e2b4e12cf1ce15a26172ac8f2166c5e02ca89351.zip
quit creating note function if citekey contains special char
Diffstat (limited to 'src/bibiman.rs')
-rw-r--r--src/bibiman.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bibiman.rs b/src/bibiman.rs
index 87963dc..6d21f8c 100644
--- a/src/bibiman.rs
+++ b/src/bibiman.rs
@@ -755,13 +755,15 @@ impl Bibiman {
pub fn create_note(&mut self, cfg: &BibiConfig) -> Result<()> {
// Index of selected entry
let entry_idx = self.entry_table.entry_table_state.selected().unwrap();
- let citekey = self.entry_table.entry_table_items[entry_idx].citekey();
+ let citekey = self.entry_table.entry_table_items[entry_idx]
+ .citekey
+ .clone();
// Index of selected popup field
let popup_idx = self.popup_area.popup_state.selected().unwrap();
let ext = self.popup_area.popup_list[popup_idx].1.clone();
- let basename = PathBuf::from(citekey).with_extension(ext);
+ let basename = PathBuf::from(&citekey).with_extension(ext);
let path = cfg.general.note_path.as_ref().unwrap();
let new_file = path.join(basename);
@@ -775,6 +777,7 @@ impl Bibiman {
File::create_new(new_file).unwrap();
self.close_popup();
self.update_lists(cfg);
+ self.select_entry_by_citekey(&citekey);
Ok(())
}