Allow yanking an entry with y
This commit is contained in:
parent
f1eeb7b24e
commit
0439c3a637
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user