summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2021-10-02 08:24:35 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2021-10-02 08:24:35 -0400
commitbb00337268e397e9c22b17dbfa77646bad90bd51 (patch)
treeb3dc2ba6f52da009d10ebbe1aab8fd0f2d2b97de /src/util
parent4a22c9a36c2895b3937daa23568b4f1cef599ed9 (diff)
parent5e3839ad3255d7056c00d09e479c234b87730ba8 (diff)
Merge branch 'main' into dev
Diffstat (limited to 'src/util')
-rw-r--r--src/util/input.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/util/input.rs b/src/util/input.rs
index 4e831d0..8e00789 100644
--- a/src/util/input.rs
+++ b/src/util/input.rs
@@ -5,7 +5,11 @@ use signal_hook::consts::signal;
use termion::event::{Event, Key, MouseButton, MouseEvent};
use tui::layout::{Constraint, Direction, Layout};
+<<<<<<< HEAD
use crate::commands::{cursor_move, parent_cursor_move, AppExecute, CommandKeybind, KeyCommand};
+=======
+use crate::commands::{cursor_move, parent_cursor_move, AppExecute, KeyCommand};
+>>>>>>> main
use crate::config::AppKeyMapping;
use crate::context::AppContext;
use crate::event::AppEvent;
@@ -133,7 +137,12 @@ pub fn process_file_preview(
}
}
-pub fn process_mouse(event: MouseEvent, context: &mut AppContext, backend: &mut ui::TuiBackend) {
+pub fn process_mouse(
+ event: MouseEvent,
+ context: &mut AppContext,
+ backend: &mut ui::TuiBackend,
+ keymap_t: &AppKeyMapping,
+) {
let f_size = backend.terminal.as_ref().unwrap().size().unwrap();
let constraints: &[Constraint; 3] = &context.config_ref().display_options_ref().default_layout;
@@ -153,12 +162,12 @@ pub fn process_mouse(event: MouseEvent, context: &mut AppContext, backend: &mut
MouseEvent::Press(MouseButton::WheelUp, x, _) => {
if x < layout_rect[1].x {
let command = KeyCommand::ParentCursorMoveUp(1);
- if let Err(e) = command.execute(context, backend) {
+ if let Err(e) = command.execute(context, backend, keymap_t) {
context.message_queue_mut().push_error(e.to_string());
}
} else if x < layout_rect[2].x {
let command = KeyCommand::CursorMoveUp(1);
- if let Err(e) = command.execute(context, backend) {
+ if let Err(e) = command.execute(context, backend, keymap_t) {
context.message_queue_mut().push_error(e.to_string());
}
} else {
@@ -168,12 +177,12 @@ pub fn process_mouse(event: MouseEvent, context: &mut AppContext, backend: &mut
MouseEvent::Press(MouseButton::WheelDown, x, _) => {
if x < layout_rect[1].x {
let command = KeyCommand::ParentCursorMoveDown(1);
- if let Err(e) = command.execute(context, backend) {
+ if let Err(e) = command.execute(context, backend, keymap_t) {
context.message_queue_mut().push_error(e.to_string());
}
} else if x < layout_rect[2].x {
let command = KeyCommand::CursorMoveDown(1);
- if let Err(e) = command.execute(context, backend) {
+ if let Err(e) = command.execute(context, backend, keymap_t) {
context.message_queue_mut().push_error(e.to_string());
}
} else {