From 9c2fef5c1481d852b69ea342a38fec3eb6337524 Mon Sep 17 00:00:00 2001 From: lukeflo Date: Sat, 16 Nov 2024 15:56:23 +0100 Subject: replaced some Strings with &str, impl lifetimes for structs --- src/app.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/app.rs') 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::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(), ); } } -- cgit v1.2.3