From 05491304bf5bbb391fdcd9e4f0dff6e82918b3ad Mon Sep 17 00:00:00 2001 From: dailz Date: Tue, 14 Apr 2026 09:36:03 +0800 Subject: [PATCH] fix(tui): allow free scrolling during progressive loading total_lines() was returning sampled_line_count() (only ~300 lines from the initial 64KB scan) during the Loading state, capping the scroll range. Use estimated_lines instead so the user can scroll to any position while indexing runs in the background. get_line() already supports incremental forward scanning on demand. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- crates/tui/src/app.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/tui/src/app.rs b/crates/tui/src/app.rs index a7dbd45..b6ea931 100644 --- a/crates/tui/src/app.rs +++ b/crates/tui/src/app.rs @@ -634,8 +634,16 @@ impl App { pub fn total_lines(&self) -> usize { match &self.loading_state { AppLoadingState::Ready { reader } => reader.line_count(), - AppLoadingState::Loading { reader, .. } => { - reader.sampled_line_count() + AppLoadingState::Loading { + reader, + estimated_lines, + .. + } => { + // Use estimated total lines (not sampled_line_count) so the user can + // scroll freely during indexing. get_line() incrementally scans + // forward on demand, so lines beyond the initial 64KB are still + // accessible. The .max() guards against under-estimates. + (*estimated_lines as usize).max(reader.sampled_line_count()) } _ => 0, }