aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorlukeflo2024-11-16 15:56:23 +0100
committerlukeflo2024-11-16 15:56:23 +0100
commit9c2fef5c1481d852b69ea342a38fec3eb6337524 (patch)
tree5ef64bd7b72258f07eeac9f528294d3757818998 /src/app.rs
parentc639cd2b7bd37e98e4469b8fb6f6d92660acaed0 (diff)
downloadbibiman-9c2fef5c1481d852b69ea342a38fec3eb6337524.tar.gz
bibiman-9c2fef5c1481d852b69ea342a38fec3eb6337524.zip
replaced some Strings with &str, impl lifetimes for structs
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/app.rs b/src/app.rs
index 6163ae3..33baf2d 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -29,18 +29,18 @@ use tui_input::Input;
// Application.
#[derive(Debug)]
-pub struct App {
+pub struct App<'a> {
// Is the application running?
pub running: bool,
// bibimain
- pub bibiman: Bibiman,
+ pub bibiman: Bibiman<'a>,
// Input mode
pub input: Input,
// Input mode bool
pub input_mode: bool,
}
-impl App {
+impl App<'_> {
// Constructs a new instance of [`App`].
pub fn new(args: CLIArgs) -> Result<Self> {
// Self::default()
@@ -228,10 +228,18 @@ impl App {
}
CmdAction::YankItem => {
if let CurrentArea::EntryArea = self.bibiman.current_area {
- Bibiman::yank_text(self.bibiman.get_selected_citekey());
+ let citekey: &str = &self.bibiman.entry_table.entry_table_items[self
+ .bibiman
+ .entry_table
+ .entry_table_state
+ .selected()
+ .unwrap()]
+ .citekey;
+
+ Bibiman::yank_text(citekey);
self.bibiman.popup_area.popup_message(
- "Yanked citekey to clipboard:".to_owned(),
- self.bibiman.get_selected_citekey().to_string(),
+ "Yanked citekey to clipboard: ",
+ citekey, // self.bibiman.get_selected_citekey(),
);
}
}