Allow yanking an entry with y

This commit is contained in:
kageru 2020-04-23 14:06:45 +02:00
parent f1eeb7b24e
commit 0439c3a637
2 changed files with 11 additions and 0 deletions

@ -49,6 +49,11 @@ pub trait ListView<T: fmt::Display + Clone> {
}
}
fn yank(&mut self) {
let index = *self.selection_pointer();
*self.register() = self.list()[index].clone().into();
}
// printing
fn printable(&mut self) -> Vec<String> {
self.list().iter().map(T::to_string).collect()

@ -75,6 +75,12 @@ impl Tracc {
with_focused!(ListView::remove_current);
}
}
// yy
Key::Char('y') => {
if let Some(Ok(Key::Char('y'))) = inputs.next() {
with_focused!(ListView::yank);
}
}
Key::Char('p') => with_focused!(ListView::paste),
Key::Char('\t') => {
self.focus = match self.focus {