Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/log-viewer-dead-scroll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@aliou/pi-processes": patch
---

Fixed a dead zone in the `/ps:logs` overlay where up to a screenful of
scroll keypresses could be swallowed. The clamped viewport end is now
written back to the scroll anchor in both the truncated and full render
paths, so every keypress moves the view.
8 changes: 8 additions & 0 deletions extensions/processes-logs/components/log-file-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ export class LogFileViewer {
visible.length,
Math.max(Math.min(height, visible.length), rawEnd),
);
// Write the clamped end back so the anchor always matches the screen.
// Otherwise scrolling mutates a stale anchor while the clamp above
// swallows the change, leaving a dead zone of up to a screenful of
// scroll keypresses.
if (!this.follow && this.anchorEnd !== null) this.anchorEnd = end;
const start = Math.max(0, end - height);
const matchSet = new Set(this.searchMatches);
const currentMatchIndex =
Expand Down Expand Up @@ -301,6 +306,9 @@ export class LogFileViewer {
totalDisplayRows,
Math.max(Math.min(height, totalDisplayRows), rawEnd),
);
// Same anchor normalization as the truncated path: keep the stored
// anchor truthful so scrollBy starts from the rendered bottom edge.
if (!this.follow && this.anchorEnd !== null) this.anchorEnd = end;
const start = Math.max(0, end - height);

const rendered = rows.slice(start, end).map((row) => row.text);
Expand Down