Skip to content

Commit

Permalink
Do not gobble events when it is not the one you are not interested in. (
Browse files Browse the repository at this point in the history
  • Loading branch information
gbin authored Jan 30, 2025
1 parent d8704e5 commit 3c12873
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
19 changes: 11 additions & 8 deletions components/monitors/cu_consolemon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,10 @@ impl UI {
})?;

if event::poll(Duration::from_millis(50))? {
if let Event::Key(key) = event::read()? {
match key.code {
let event = event::read()?;

match event {
Event::Key(key) => match key.code {
KeyCode::Char('1') => self.active_screen = Screen::Neofetch,
KeyCode::Char('2') => self.active_screen = Screen::Dag,
KeyCode::Char('3') => self.active_screen = Screen::Latency,
Expand Down Expand Up @@ -576,14 +578,15 @@ impl UI {
break;
}
_ => {}
}
}
},

#[cfg(feature = "debug_pane")]
if let Event::Resize(_columns, rows) = event::read()? {
if let Some(debug_output) = self.debug_output.as_mut() {
debug_output.max_rows.store(rows, Ordering::SeqCst)
#[cfg(feature = "debug_pane")]
Event::Resize(_columns, rows) => {
if let Some(debug_output) = self.debug_output.as_mut() {
debug_output.max_rows.store(rows, Ordering::SeqCst)
}
}
_ => {}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion examples/cu_caterpillar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ cu29 = { workspace = true }
cu29-helpers = { workspace = true }
cu29-export = { workspace = true }
bincode = { workspace = true }
cu-consolemon = { path = "../../components/monitors/cu_consolemon", version = "0.6.0" } # needed
# cu-consolemon = { path = "../../components/monitors/cu_consolemon", default-features = false, version = "0.6" } # needed
cu-consolemon = { path = "../../components/monitors/cu_consolemon", version = "0.6" } # needed
cu-rp-gpio = { path = "../../components/sinks/cu_rp_gpio", version = "0.6.0" }
tempfile = "3.14.0"

Expand Down

0 comments on commit 3c12873

Please sign in to comment.