Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

<a name="v3.7.0"></a>
### v3.7.0 - 2024/12/27
Expand Down
25 changes: 11 additions & 14 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
};

Expand Down Expand Up @@ -102,6 +97,9 @@ fn run_mission(
headless: bool,
) -> Result<DoAfterMission> {
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());
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
_ => {}
}
Expand Down
12 changes: 4 additions & 8 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::io::Stdout>;

Expand Down Expand Up @@ -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)?;
Expand Down