summaryrefslogtreecommitdiffstats
path: root/rsnix/src/tty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rsnix/src/tty.rs')
-rw-r--r--rsnix/src/tty.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/rsnix/src/tty.rs b/rsnix/src/tty.rs
index 918f6e0..c44dca8 100644
--- a/rsnix/src/tty.rs
+++ b/rsnix/src/tty.rs
@@ -139,7 +139,14 @@ pub fn read_line() -> LineInput {
139/// windowed shells). Same semantics as `read_line` but keys arrive as 139/// windowed shells). Same semantics as `read_line` but keys arrive as
140/// `TaskMsg::Key` instead of from the global PS/2 queue. Returns `None` 140/// `TaskMsg::Key` instead of from the global PS/2 queue. Returns `None`
141/// on `TaskMsg::Close` (window was closed). 141/// on `TaskMsg::Close` (window was closed).
142pub fn read_line_from_queue() -> Option<LineInput> { 142/// Read one line in canonical mode from the task's message queue (for
143/// windowed shells). Same semantics as `read_line` but keys arrive as
144/// `TaskMsg::Key` instead of from the global PS/2 queue. Returns `None`
145/// on `TaskMsg::Close` (window was closed).
146///
147/// Handles `TaskMsg::Focus` to toggle the global `ACTIVE` redirect so
148/// gop_print! goes to the right terminal buffer.
149pub fn read_line_from_queue(term: &mut crate::vt::Terminal) -> Option<LineInput> {
143 crate::vt::sync_scroll(); 150 crate::vt::sync_scroll();
144 let mut buf = strbuf::String::<LINE_BUF_SIZE>::new(); 151 let mut buf = strbuf::String::<LINE_BUF_SIZE>::new();
145 loop { 152 loop {
@@ -191,6 +198,13 @@ pub fn read_line_from_queue() -> Option<LineInput> {
191 } 198 }
192 _ => {} 199 _ => {}
193 }, 200 },
201 crate::sched::TaskMsg::Focus(gained) => {
202 if gained {
203 crate::vt::set_active(term as *mut crate::vt::Terminal);
204 } else {
205 crate::vt::set_active(core::ptr::null_mut());
206 }
207 }
194 crate::sched::TaskMsg::Close => return None, 208 crate::sched::TaskMsg::Close => return None,
195 _ => {} 209 _ => {}
196 } 210 }