aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/app.rs b/src/app.rs
index 1eaa1a3..24d9eed 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -179,7 +179,9 @@ impl App {
Some(PopupKind::Help) => {
self.bibiman.popup_area.popup_scroll_down();
}
- Some(PopupKind::OpenRes) | Some(PopupKind::AppendToFile) => {
+ Some(PopupKind::OpenRes)
+ | Some(PopupKind::AppendToFile)
+ | Some(PopupKind::YankItem) => {
self.bibiman.popup_area.popup_state.scroll_down_by(1)
}
_ => {}
@@ -198,7 +200,9 @@ impl App {
Some(PopupKind::Help) => {
self.bibiman.popup_area.popup_scroll_up();
}
- Some(PopupKind::OpenRes) | Some(PopupKind::AppendToFile) => {
+ Some(PopupKind::OpenRes)
+ | Some(PopupKind::AppendToFile)
+ | Some(PopupKind::YankItem) => {
self.bibiman.popup_area.popup_state.scroll_up_by(1)
}
_ => {}
@@ -256,6 +260,8 @@ impl App {
} else if let Some(PopupKind::AppendToFile) = self.bibiman.popup_area.popup_kind
{
self.bibiman.close_popup();
+ } else if let Some(PopupKind::YankItem) = self.bibiman.popup_area.popup_kind {
+ self.bibiman.close_popup();
}
} else {
self.bibiman.reset_current_list();
@@ -272,6 +278,8 @@ impl App {
} else if let Some(PopupKind::AppendToFile) = self.bibiman.popup_area.popup_kind
{
self.bibiman.append_entry_to_file()?
+ } else if let Some(PopupKind::YankItem) = self.bibiman.popup_area.popup_kind {
+ self.bibiman.yank_entry_field()?
}
}
}
@@ -285,20 +293,25 @@ impl App {
}
CmdAction::YankItem => {
if let CurrentArea::EntryArea = self.bibiman.current_area {
- let citekey: &str = &self.bibiman.entry_table.entry_table_items[self
+ let idx = self
.bibiman
.entry_table
.entry_table_state
.selected()
- .unwrap()]
- .citekey;
-
- Bibiman::yank_text(citekey);
- self.bibiman.popup_area.popup_message(
- "Yanked citekey to clipboard: ",
- citekey, // self.bibiman.get_selected_citekey(),
- true,
- );
+ .unwrap();
+ let entry = self.bibiman.entry_table.entry_table_items[idx].clone();
+ let mut items = vec!["Citekey".to_owned()];
+ if entry.doi_url.is_some() {
+ items.push("Weblink".to_owned())
+ }
+ if entry.filepath.is_some() {
+ items.push("Filepath".to_owned())
+ }
+ self.bibiman.popup_area.popup_kind = Some(PopupKind::YankItem);
+ self.bibiman.popup_area.popup_selection(items);
+ self.bibiman.former_area = Some(FormerArea::EntryArea);
+ self.bibiman.current_area = CurrentArea::PopupArea;
+ self.bibiman.popup_area.popup_state.select(Some(0));
}
}
CmdAction::EditFile => {