diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-21 03:30:35 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-21 03:30:35 +0200 |
| commit | b418c26050870b900ff56d5a47f32209795aaf4a (patch) | |
| tree | cdc181c63b2bbd3a3c1f608cbe0faf9a4e86877b /rsnix/src/tty.rs | |
| parent | wm: F1 spawns a windowed shell — real shell, not a duplicate (diff) | |
| download | rs-dos-b418c26050870b900ff56d5a47f32209795aaf4a.tar.gz rs-dos-b418c26050870b900ff56d5a47f32209795aaf4a.zip | |
v0.5.11: fix terminal focus — toggle ACTIVE on Focus messages
- tty: read_line_from_queue() now takes &mut Terminal and handles
TaskMsg::Focus: Focus(true) sets ACTIVE to the terminal,
Focus(false) clears it. This fixes the bug where the console
shell's gop_print! output was redirected to the soft terminal
even after focus switched away from it.
- shell: run_windowed() passes the terminal through to read_line_from_queue.
- wm: remove noisy per-key debug logging from pump_main.
Diffstat (limited to '')
| -rw-r--r-- | rsnix/src/tty.rs | 16 |
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). |
| 142 | pub 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. | ||
| 149 | pub 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 | } |
