From c2b6daeaaf1da5c6f81300e954f2b3592c0668c0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sat, 1 Aug 2026 18:03:20 +0200 Subject: klog/tty/pager: no more truncated lines — full lines flow, terminal wraps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- shell/src/lib.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'shell') 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 { Pause { shown: usize, screen: usize, + cols: usize, }, } @@ -433,6 +434,10 @@ impl Pipeline { Filter::Pause => StageState::Pause { shown: 0, screen: rsnix::vt::size().0.saturating_sub(1).max(1), + // Rows a screenful of *wrapped* output occupies: a + // line wider than the terminal takes more than one + // row, so the pager counts rows, not lines. + cols: rsnix::vt::size().1.max(1), }, }; stages.push((f.clone(), st)); @@ -510,14 +515,17 @@ impl Pipeline { } } Filter::Pause => { - let StageState::Pause { shown, screen } = st else { + let StageState::Pause { shown, screen, cols } = st else { unreachable!("stage state does not match filter") }; for l in cur.drain(..) { + // Rows this line occupies after terminal wrapping + // (at least 1; an empty line is one row). + let rows = l.len().div_ceil(*cols); if *shown > 0 && *shown % *screen == 0 && !pager_wait() { return false; } - *shown += 1; + *shown += rows; out.push(l); } } -- cgit v1.2.3