From 8db363c045fb8d5c6a39155e7885c0607878658d Mon Sep 17 00:00:00 2001 From: "Matheus T. dos Santos" Date: Fri, 15 Mar 2024 10:02:44 -0300 Subject: [PATCH] fix: fix windows double press and change back horizontal scroll to control modifier --- src/command_bar.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/command_bar.rs b/src/command_bar.rs index b254b6f..bfcdf7f 100644 --- a/src/command_bar.rs +++ b/src/command_bar.rs @@ -5,7 +5,9 @@ use crate::plugin_manager::PluginManager; use crate::serial::SerialIF; use crate::text::TextView; use chrono::Local; -use crossterm::event::{Event, EventStream, KeyCode, KeyEvent, KeyModifiers, MouseEventKind}; +use crossterm::event::{ + Event, EventStream, KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseEventKind, +}; use futures::StreamExt; use rand::seq::SliceRandom; use ratatui::layout::{Constraint, Direction, Layout, Rect}; @@ -92,14 +94,16 @@ impl CommandBar { match event { Some(Ok(event)) => match event { - Event::Mouse(mouse_evt) if mouse_evt.modifiers == KeyModifiers::SHIFT => { + Event::Mouse(mouse_evt) if mouse_evt.modifiers == KeyModifiers::CONTROL => { match mouse_evt.kind { MouseEventKind::ScrollUp => sender.send(HorizontalScroll(-1)).unwrap(), MouseEventKind::ScrollDown => sender.send(HorizontalScroll(1)).unwrap(), _ => {} } } - Event::Key(key) => sender.send(Key(key)).unwrap(), + Event::Key(key) if key.kind == KeyEventKind::Press => { + sender.send(Key(key)).unwrap() + } Event::Mouse(mouse_evt) => match mouse_evt.kind { MouseEventKind::ScrollUp => sender.send(VerticalScroll(-1)).unwrap(), MouseEventKind::ScrollDown => sender.send(VerticalScroll(1)).unwrap(),