Skip to content

fix: include short viewport output in recent reads - #3448

Merged
ogulcancelik merged 1 commit into
herdrdev:masterfrom
akbash-bot:akbash/3444-recent-includes-viewport
Sep 2, 2026
Merged

fix: include short viewport output in recent reads#3448
ogulcancelik merged 1 commit into
herdrdev:masterfrom
akbash-bot:akbash/3444-recent-includes-viewport

Conversation

@akbash-bot

@akbash-bot akbash-bot commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Issue

A short command is visible in a fresh pane, but pane read returns no text from recent or recent-unwrapped when the requested line count is smaller than the viewport.

Problem

The recent range ended at the physical bottom of the terminal. Unused blank rows after the prompt could consume the entire line limit before trailing blanks were removed.

How did we fix it?

Herdr now ends primary-screen recent reads at the last content row or cursor row. A completely blank viewport and alternate screens keep their previous behavior. Wrapped and unwrapped reads use the same corrected range.

Verification

A focused test and the exact clean-session reproduction failed before the change. Both recent sources now return the short command before scrollback exists, and scrollback tail reads still work. Focused regression checks pass. Local just check passed 3541 of 3542 tests; an unrelated live-handoff replacement-process test failed locally. PR CI passes on Linux, macOS, and Windows.

refs #3444

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b0602220-f01e-4845-b28d-5b43fadaa99a

📥 Commits

Reviewing files that changed from the base of the PR and between 0cbd1a5 and 7c814dd.

📒 Files selected for processing (2)
  • src/ghostty/mod.rs
  • src/pane/terminal.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Added the public Terminal::cursor_y method. Updated primary-screen recent reads to calculate the end row from the viewport cursor position and the last non-blank row. Alternate-screen reads continue to use the physical end row. Added tests for no-scrollback primary reads and alternate-screen reads.

Suggested reviewers: ogulcancelik

Merge Risk: ⚪ Minimal · up to 7c814

This change makes short recent terminal reads include visible command output while preserving alternate-screen behavior. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the recent-read bug, the primary-screen fix, preserved behavior, and verification results. It is directly related to the changeset.
Title check ✅ Passed The title clearly summarizes the primary change: fixing recent reads for short viewport output.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kangal-bot

Copy link
Copy Markdown
Collaborator

@coderabbitai review
@greptileai

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

@kangal-bot I will review the changes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adjusts primary-screen recent reads to end at the last textual content row or cursor row, preventing unused viewport rows from hiding short output.

  • Adds a Ghostty cursor-row accessor.
  • Preserves physical-bottom behavior for alternate screens and completely blank viewports.
  • Adds focused tests for fresh primary-screen output and alternate-screen behavior.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified.

The cursor and screen coordinates are converted consistently into absolute grid rows, alternate-screen behavior is preserved, and the new regression tests cover the intended fresh-viewport behavior.

Important Files Changed

Filename Overview
src/ghostty/mod.rs Adds a typed accessor for Ghostty's zero-indexed cursor row within the active area.
src/pane/terminal.rs Corrects recent-read bounds on primary screens and adds regression coverage without introducing an actionable defect.

Reviews (1): Last reviewed commit: "fix: include short viewport output in re..." | Re-trigger Greptile

@akbash-bot
akbash-bot force-pushed the akbash/3444-recent-includes-viewport branch from 7c814dd to 67c7c7c Compare August 31, 2026 14:46
@ogulcancelik
ogulcancelik merged commit 45484aa into herdrdev:master Sep 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants