diff options
author | Vinegret43 <67828321+Vinegret43@users.noreply.github.com> | 2021-10-02 15:20:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-02 08:20:02 -0400 |
commit | 5e3839ad3255d7056c00d09e479c234b87730ba8 (patch) | |
tree | c64f16062563c73571b24d5e4baf5bef866bf610 /src/util | |
parent | 44c1952831abc4bc8496dfd60e72e47dcdc45caa (diff) |
Add a help page (#95)
* add basic help page functionality
change search_skim keybind
* refactor 'run' function, improve sorting
* add search functionality for help page
improve some comments in tui_help
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/input.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/util/input.rs b/src/util/input.rs index 9aa2231..48e416c 100644 --- a/src/util/input.rs +++ b/src/util/input.rs @@ -7,6 +7,7 @@ use termion::event::{MouseButton, MouseEvent}; use tui::layout::{Constraint, Direction, Layout}; use crate::commands::{cursor_move, parent_cursor_move, AppExecute, KeyCommand}; +use crate::config::AppKeyMapping; use crate::context::AppContext; use crate::event::AppEvent; use crate::fs::JoshutoDirList; @@ -93,7 +94,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; @@ -113,12 +119,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 { @@ -128,12 +134,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 { |