diff options
author | qkzk <qu3nt1n@gmail.com> | 2022-12-11 16:40:13 +0100 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2022-12-11 16:40:13 +0100 |
commit | 6f74985065f6d4a1b01213b693fe7e7eb23c9046 (patch) | |
tree | 84f38261dd36dd6d6f7a8efb027263d53b7150a7 /src/actioner.rs | |
parent | 923170af44c18feab1a16aae0d6e6139de7c5249 (diff) |
remove more actions from actioner. Need a rename
Diffstat (limited to 'src/actioner.rs')
-rw-r--r-- | src/actioner.rs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/actioner.rs b/src/actioner.rs index 12d7184..82dbd0c 100644 --- a/src/actioner.rs +++ b/src/actioner.rs @@ -26,12 +26,10 @@ impl Actioner { Event::Key(Key::WheelUp(_, _, _)) => EventExec::event_move_up(status), Event::Key(Key::WheelDown(_, _, _)) => EventExec::event_move_down(status), Event::Key(Key::SingleClick(MouseButton::Left, row, _)) => { - Self::left_click(status, row); - Ok(()) + EventExec::event_select_row(status, row) } Event::Key(Key::SingleClick(MouseButton::Right, row, _)) => { - Self::right_click(status, row); - Ok(()) + EventExec::event_right_click(status, row) } Event::User(_) => EventExec::refresh_selected_view(status), Event::Resize { width, height } => EventExec::resize(status, width, height), @@ -48,24 +46,10 @@ impl Actioner { } } - /// Select this file - fn left_click(status: &mut Status, row: u16) { - if let Mode::Normal = status.selected_non_mut().mode { - EventExec::event_select_row(status.selected(), row) - } - } - - /// Open a directory or a file - fn right_click(status: &mut Status, row: u16) { - if let Mode::Normal = status.selected_non_mut().mode { - let _ = EventExec::event_right_click(status.selected(), row); - } - } - /// Match read key to a relevent event, depending on keybindings. /// Keybindings are read from `Config`. - fn char(&self, status: &mut Status, k: Key) -> FmResult<()> { - match k { + fn char(&self, status: &mut Status, key_char: Key) -> FmResult<()> { + match key_char { Key::Char(c) => match status.selected_non_mut().mode { Mode::Newfile | Mode::Newdir | Mode::Chmod | Mode::Rename | Mode::Filter => { EventExec::event_text_insertion(status.selected(), c); @@ -79,7 +63,7 @@ impl Actioner { Mode::Goto | Mode::Exec | Mode::Search => { EventExec::event_text_insert_and_complete(status.selected(), c) } - Mode::Normal => match self.binds.get(&k) { + Mode::Normal => match self.binds.get(&key_char) { Some(event_char) => event_char.matcher(status), None => Ok(()), }, |