diff --git a/CHANGELOG.md b/CHANGELOG.md index 93060e0..6d653cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### next - with `--headless`, bacon runs without TUI - Fix #293 - `--config-toml` argument - Fix #284 +- fix workspace level Cargo.toml file not watched ### v3.7.0 - 2024/12/27 diff --git a/src/app.rs b/src/app.rs index 6b16cf1..9818965 100644 --- a/src/app.rs +++ b/src/app.rs @@ -11,16 +11,11 @@ use { EventSourceOptions, Ticker, crossbeam::channel::select, - crossterm::event::Event, - }, -}; - -#[cfg(windows)] -use { - crokey::key, - termimad::crossterm::event::{ - MouseEvent, - MouseEventKind, + crossterm::event::{ + Event, + MouseEvent, + MouseEventKind, + }, }, }; @@ -102,6 +97,9 @@ fn run_mission( headless: bool, ) -> Result { let keybindings = mission.settings.keybindings.clone(); + let scroll_multiplier = 3; // TODO can we read the OS setting? + let wheel_down = Internal::Scroll(ScrollCommand::Lines(scroll_multiplier)).into(); + let wheel_up = Internal::Scroll(ScrollCommand::Lines(-scroll_multiplier)).into(); // build the watcher detecting and transmitting mission file changes let ignorer = time!(Info, mission.ignorer()); @@ -204,6 +202,7 @@ fn run_mission( } } recv(user_events) -> user_event => { + info!("user event received: {:#?}", user_event); match user_event?.event { Event::Resize(mut width, mut height) => { state.resize(width, height); @@ -215,13 +214,11 @@ fn run_mission( action = keybindings.get(key_combination); } } - #[cfg(windows)] Event::Mouse(MouseEvent { kind: MouseEventKind::ScrollDown, .. }) => { - action = keybindings.get(key!(down)); + action = Some(&wheel_down); } - #[cfg(windows)] Event::Mouse(MouseEvent { kind: MouseEventKind::ScrollUp, .. }) => { - action = keybindings.get(key!(up)); + action = Some(&wheel_up); } _ => {} } diff --git a/src/cli.rs b/src/cli.rs index 9977367..d7f5335 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -9,18 +9,16 @@ use { termimad::crossterm::{ QueueableCommand, cursor, + event::{ + DisableMouseCapture, + EnableMouseCapture, + }, terminal::{ EnterAlternateScreen, LeaveAlternateScreen, }, }, }; - -#[cfg(windows)] -use termimad::crossterm::event::{ - DisableMouseCapture, - EnableMouseCapture, -}; /// The Write type used by all GUI writing functions pub type W = std::io::BufWriter; @@ -85,13 +83,11 @@ pub fn run() -> anyhow::Result<()> { if !headless { w.queue(EnterAlternateScreen)?; w.queue(cursor::Hide)?; - #[cfg(windows)] w.queue(EnableMouseCapture)?; w.flush()?; } let result = app::run(&mut w, settings, &args, context, headless); if !headless { - #[cfg(windows)] w.queue(DisableMouseCapture)?; w.queue(cursor::Show)?; w.queue(LeaveAlternateScreen)?;