Skip to main content

rusty_bubbletea/
signals_windows.rs

1//! Cleanroom Rust port of upstream Go source file: `signals_windows.go`
2//! Upstream Target Tag / Version: `v2.0.8`
3//!
4//! <public-docs>
5//! # Signals (Windows)
6//!
7//! Windows console resize and signal handling abstractions.
8//! </public-docs>
9
10use crate::screen::WindowSizeMsg;
11use crossterm::terminal::size as term_size;
12use std::sync::mpsc::Sender;
13
14/// Listens for window size resizes on Windows systems.
15pub fn listen_for_resize_windows(tx: &Sender<Box<dyn crate::model::Msg>>) {
16    if let Ok((w, h)) = term_size() {
17        let _ = tx.send(Box::new(WindowSizeMsg {
18            width: w as usize,
19            height: h as usize,
20        }));
21    }
22}