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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -634,8 +634,16 @@ impl App {
|
|||||||
pub fn total_lines(&self) -> usize {
|
pub fn total_lines(&self) -> usize {
|
||||||
match &self.loading_state {
|
match &self.loading_state {
|
||||||
AppLoadingState::Ready { reader } => reader.line_count(),
|
AppLoadingState::Ready { reader } => reader.line_count(),
|
||||||
AppLoadingState::Loading { reader, .. } => {
|
AppLoadingState::Loading {
|
||||||
reader.sampled_line_count()
|
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,
|
_ => 0,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user