summaryrefslogtreecommitdiffstats
path: root/shell/src/lib.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 18:03:20 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 18:03:20 +0200
commitc2b6daeaaf1da5c6f81300e954f2b3592c0668c0 (patch)
tree62411383ea6a2d69ecf2b0fdf3e18155e660796d /shell/src/lib.rs
parentrsnix: preemptive kernel tasks (ADR 0003) — sched, IST fault stacks, 176-by... (diff)
downloadrs-dos-c2b6daeaaf1da5c6f81300e954f2b3592c0668c0.tar.gz
rs-dos-c2b6daeaaf1da5c6f81300e954f2b3592c0668c0.zip
klog/tty/pager: no more truncated lines — full lines flow, terminal wraps
- klog: MAX_LINE 128 -> 512 (lens widened u8 -> u16) — long serial_println lines (panics, boot messages) are no longer cut at 128 bytes; they print in full and the terminal wraps them at the screen edge - tty: LINE_BUF_SIZE 256 -> 1024 — typed command lines longer than 256 chars were silently dropped at the buffer limit; now they echo and submit in full (the terminal already wraps the echo mid-typing) - pager (-p): screenfuls now count wrapped rows, not lines — a line wider than the terminal occupies ceil(len/cols) rows, so the pause lands at a real screen boundary instead of overflowing it
Diffstat (limited to 'shell/src/lib.rs')
-rw-r--r--shell/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/shell/src/lib.rs b/shell/src/lib.rs
index 97fa6c2..617e5a4 100644
--- a/shell/src/lib.rs
+++ b/shell/src/lib.rs
@@ -365,6 +365,7 @@ enum StageState {
365 Pause { 365 Pause {
366 shown: usize, 366 shown: usize,
367 screen: usize, 367 screen: usize,
368 cols: usize,
368 }, 369 },
369} 370}
370 371
@@ -433,6 +434,10 @@ impl Pipeline {
433 Filter::Pause => StageState::Pause { 434 Filter::Pause => StageState::Pause {
434 shown: 0, 435 shown: 0,
435 screen: rsnix::vt::size().0.saturating_sub(1).max(1), 436 screen: rsnix::vt::size().0.saturating_sub(1).max(1),
437 // Rows a screenful of *wrapped* output occupies: a
438 // line wider than the terminal takes more than one
439 // row, so the pager counts rows, not lines.
440 cols: rsnix::vt::size().1.max(1),
436 }, 441 },
437 }; 442 };
438 stages.push((f.clone(), st)); 443 stages.push((f.clone(), st));
@@ -510,14 +515,17 @@ impl Pipeline {
510 } 515 }
511 } 516 }
512 Filter::Pause => { 517 Filter::Pause => {
513 let StageState::Pause { shown, screen } = st else { 518 let StageState::Pause { shown, screen, cols } = st else {
514 unreachable!("stage state does not match filter") 519 unreachable!("stage state does not match filter")
515 }; 520 };
516 for l in cur.drain(..) { 521 for l in cur.drain(..) {
522 // Rows this line occupies after terminal wrapping
523 // (at least 1; an empty line is one row).
524 let rows = l.len().div_ceil(*cols);
517 if *shown > 0 && *shown % *screen == 0 && !pager_wait() { 525 if *shown > 0 && *shown % *screen == 0 && !pager_wait() {
518 return false; 526 return false;
519 } 527 }
520 *shown += 1; 528 *shown += rows;
521 out.push(l); 529 out.push(l);
522 } 530 }
523 } 531 }