diff options
-rw-r--r-- | src/commands/key_command.rs | 1 | ||||
-rw-r--r-- | src/util/input_process.rs | 18 | ||||
-rw-r--r-- | src/util/key_mapping.rs | 2 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/commands/key_command.rs b/src/commands/key_command.rs index ff496cc..3bdb57d 100644 --- a/src/commands/key_command.rs +++ b/src/commands/key_command.rs @@ -33,7 +33,6 @@ pub enum KeyCommand { // ChildCursorMoveUp(usize), // ChildCursorMoveDown(usize), - DeleteFiles, NewDirectory(path::PathBuf), OpenFile, diff --git a/src/util/input_process.rs b/src/util/input_process.rs index 3f0c091..942703b 100644 --- a/src/util/input_process.rs +++ b/src/util/input_process.rs @@ -1,6 +1,6 @@ use signal_hook::consts::signal; -use tui::layout::{Constraint, Direction, Layout, Rect}; use termion::event::{MouseButton, MouseEvent}; +use tui::layout::{Constraint, Direction, Layout}; use crate::commands::{JoshutoRunnable, KeyCommand}; use crate::context::JoshutoContext; @@ -10,7 +10,11 @@ use crate::ui; use crate::util::event::JoshutoEvent; use crate::util::format; -pub fn process_mouse(event: MouseEvent, context: &mut JoshutoContext, backend: &mut ui::TuiBackend) { +pub fn process_mouse( + event: MouseEvent, + context: &mut JoshutoContext, + backend: &mut ui::TuiBackend, +) { let f_size = backend.terminal.as_ref().unwrap().size().unwrap(); let constraints: &[Constraint; 3] = &context.config_ref().default_layout; @@ -21,21 +25,23 @@ pub fn process_mouse(event: MouseEvent, context: &mut JoshutoContext, backend: & .split(f_size); let command = match event { - MouseEvent::Press(MouseButton::WheelUp, x, y) => { + MouseEvent::Press(MouseButton::WheelUp, x, _) => { if x < layout_rect[1].x { Some(KeyCommand::ParentCursorMoveUp(1)) } else if x < layout_rect[2].x { Some(KeyCommand::CursorMoveUp(1)) - } else { // TODO: scroll in child list + } else { + // TODO: scroll in child list Some(KeyCommand::CursorMoveUp(1)) } } - MouseEvent::Press(MouseButton::WheelDown, x, y) => { + MouseEvent::Press(MouseButton::WheelDown, x, _) => { if x < layout_rect[1].x { Some(KeyCommand::ParentCursorMoveDown(1)) } else if x < layout_rect[2].x { Some(KeyCommand::CursorMoveDown(1)) - } else { // TODO: scroll in child list + } else { + // TODO: scroll in child list Some(KeyCommand::CursorMoveDown(1)) } } diff --git a/src/util/key_mapping.rs b/src/util/key_mapping.rs index d4c16f9..0ac7ee7 100644 --- a/src/util/key_mapping.rs +++ b/src/util/key_mapping.rs @@ -123,6 +123,6 @@ pub fn str_to_mouse(s: &str) -> Option<MouseEvent> { match s { "scroll_up" => Some(MouseEvent::Press(MouseButton::WheelUp, 0, 0)), "scroll_down" => Some(MouseEvent::Press(MouseButton::WheelDown, 0, 0)), - s => None, + _ => None, } } |