summaryrefslogtreecommitdiffstats
path: root/src/shell/inputs/stdin.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-03-04 18:10:49 -0500
committerJesse Luehrs <doy@tozt.net>2022-03-04 18:10:49 -0500
commite1bfb9bc59a6a97594cb5c2c51cc4ca8ee813a23 (patch)
treea7b9f6982b76e0e56c3cbc2c2909f6e9e04a8582 /src/shell/inputs/stdin.rs
parentb1c5f2f31874fc019b67ae981f66e0492b22c867 (diff)
downloadnbsh-e1bfb9bc59a6a97594cb5c2c51cc4ca8ee813a23.tar.gz
nbsh-e1bfb9bc59a6a97594cb5c2c51cc4ca8ee813a23.zip
refactor inputs
Diffstat (limited to 'src/shell/inputs/stdin.rs')
-rw-r--r--src/shell/inputs/stdin.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shell/inputs/stdin.rs b/src/shell/inputs/stdin.rs
new file mode 100644
index 0000000..b966307
--- /dev/null
+++ b/src/shell/inputs/stdin.rs
@@ -0,0 +1,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
+ }
+}