summaryrefslogtreecommitdiffstats
path: root/src/shell/inputs/stdin.rs
blob: b966307d6d1e6265fd58b8ad55561e5838ffe911 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::shell::prelude::*;

pub struct Handler;

impl Handler {
    pub fn new(
        mut input: textmode::blocking::Input,
        event_w: crate::shell::event::Writer,
    ) -> Self {
        std::thread::spawn(move || {
            while let Some(key) = input.read_key().unwrap() {
                event_w.send(Event::Key(key));
            }
        });
        Self
    }
}