Bug Description
Scroll state is tracked as a usize but ratatui's Paragraph::scroll takes a u16, and the stdout, stderr, custom and script panes all cast without clamping. Once a pane's content passes 65,535 wrapped lines, scroll_pos as u16 wraps around and follow mode pins the view near the top of the log instead of the tail, while the title still says [follow]. Nothing warns, and the user has no reason to connect it to the log's size.
Steps to Reproduce
Render a log pane with follow on and more than 65,535 wrapped lines:
let mut w = OutputWidget::new_for(StreamKind::Stdout);
w.content = (1..=70_000).map(|i| format!("line {:06}", i)).collect::<Vec<_>>().join("\n");
// draw into a 40x10 terminal, follow is on by default
Expected Behavior
The pane keeps showing the tail, or it stops at the furthest line it can reach and stops claiming to follow.
Actual Behavior
60000 lines | scroll_pos=59994 cast=59994 | shows line 059995
70000 lines | scroll_pos=69994 cast=4458 | shows line 004459 .. line 004466
ratatui does not clamp the value, it takes the wrapped one, so the pane jumps to line 4,459 of 70,000 and sits there with [follow] still in the title. scroll_pos itself is correct throughout, only the cast is wrong. Those 70,000 short lines are about 900 KB, so a normal overnight run reaches this.
System Information
sqwatch 0.2.0, source checkout at 4c594fb
Ubuntu 26.04.1, rustc 1.97.1, ratatui 0.30
Clamping at the cast with .min(u16::MAX as usize) is one line in each pane and makes the ceiling honest instead of wrapping through it. It does not let a pane scroll past 65,535 lines, nothing can with this API, which is the argument for also capping the retained buffer in #19. filter_tree.rs has the same unclamped cast, though its scroll is bounded by the number of filter items, so it is not reachable in practice.
Bug Description
Scroll state is tracked as a
usizebut ratatui'sParagraph::scrolltakes au16, and the stdout, stderr, custom and script panes all cast without clamping. Once a pane's content passes 65,535 wrapped lines,scroll_pos as u16wraps around and follow mode pins the view near the top of the log instead of the tail, while the title still says[follow]. Nothing warns, and the user has no reason to connect it to the log's size.Steps to Reproduce
Render a log pane with follow on and more than 65,535 wrapped lines:
Expected Behavior
The pane keeps showing the tail, or it stops at the furthest line it can reach and stops claiming to follow.
Actual Behavior
ratatui does not clamp the value, it takes the wrapped one, so the pane jumps to line 4,459 of 70,000 and sits there with
[follow]still in the title.scroll_positself is correct throughout, only the cast is wrong. Those 70,000 short lines are about 900 KB, so a normal overnight run reaches this.System Information
sqwatch 0.2.0, source checkout at 4c594fb Ubuntu 26.04.1, rustc 1.97.1, ratatui 0.30Clamping at the cast with
.min(u16::MAX as usize)is one line in each pane and makes the ceiling honest instead of wrapping through it. It does not let a pane scroll past 65,535 lines, nothing can with this API, which is the argument for also capping the retained buffer in #19.filter_tree.rshas the same unclamped cast, though its scroll is bounded by the number of filter items, so it is not reachable in practice.