Skip to content

Commit

Permalink
refactor: input_handler
Browse files Browse the repository at this point in the history
use a mouse_point variable
  • Loading branch information
mrjackwills committed Dec 5, 2024
1 parent de76bc2 commit 9c4f891
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/input_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ impl InputHandler {
let is_c = || key_code == KeyCode::Char('c') || key_code == KeyCode::Char('C');
let is_q = || key_code == KeyCode::Char('q') || key_code == KeyCode::Char('Q');
if key_modifier == KeyModifiers::CONTROL && is_c() || is_q() && !contains_filter {
// Always just quit on Ctrl + c/C or q/Q, unless in FIlter status active
// Always just quit on Ctrl + c/C or q/Q, unless in Filter status active
self.quit();
}

Expand Down Expand Up @@ -479,22 +479,13 @@ impl InputHandler {
MouseEventKind::ScrollUp => self.previous(),
MouseEventKind::ScrollDown => self.next(),
MouseEventKind::Down(MouseButton::Left) => {
let header = self.gui_state.lock().header_intersect(Rect::new(
mouse_event.column,
mouse_event.row,
1,
1,
));
let mouse_point = Rect::new(mouse_event.column, mouse_event.row, 1, 1);
let header = self.gui_state.lock().header_intersect(mouse_point);
if let Some(header) = header {
self.sort(header);
}

self.gui_state.lock().panel_intersect(Rect::new(
mouse_event.column,
mouse_event.row,
1,
1,
));
self.gui_state.lock().panel_intersect(mouse_point);
}
_ => (),
}
Expand Down

0 comments on commit 9c4f891

Please # to comment.