Repository navigation
Conversation
📝 WalkthroughWalkthroughChangesScrollback compatibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PTY
participant GhosttyPaneTerminal
participant ScrollbackPredicate
PTY->>GhosttyPaneTerminal: Process primary-screen scrollback-clear bytes
GhosttyPaneTerminal->>ScrollbackPredicate: Check foreground agent and clear sequence
ScrollbackPredicate-->>GhosttyPaneTerminal: Preserve viewport decision
GhosttyPaneTerminal->>GhosttyPaneTerminal: Save offset during rebuild
GhosttyPaneTerminal->>GhosttyPaneTerminal: Restore offset after rebuild
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| let offset_from_bottom = core | ||
| .terminal | ||
| .scrollbar() | ||
| .ok() | ||
| .map(|scrollbar| { | ||
| scrollbar | ||
| .total | ||
| .saturating_sub(scrollbar.offset + scrollbar.len) | ||
| }) | ||
| .unwrap_or(0); | ||
| .primary_scrollback_redraw_offset_from_bottom | ||
| .unwrap_or_else(|| ghostty_scroll_offset_from_bottom(&core.terminal)); |
There was a problem hiding this comment.
Resize ends redraw tracking early
When a resize overlaps Pi's synchronized redraw, terminal.resize() disables synchronized-output mode while the saved redraw offset remains set. The next partial PTY read therefore consumes and restores that offset before the transcript rebuild completes, causing an intermediate viewport jump and render instead of waiting for Pi's closing synchronized-output sequence.
Greptile SummaryPreserves Pi’s primary-screen viewport while synchronized transcript redraws replace scrollback after terminal resizes.
Confidence Score: 4/5The overlapping-resize state transition needs to be fixed before merging because it can complete viewport restoration before Pi finishes rebuilding its transcript. The saved offset survives Files Needing Attention: src/pane/terminal.rs
|
| Filename | Overview |
|---|---|
| src/pane/osc.rs | Centralizes foreground-agent identification, keeps ED3 filtering scoped to Droid, and identifies Pi redraws that require viewport preservation. |
| src/pane/terminal.rs | Tracks Pi’s pre-redraw offset across PTY reads, but an overlapping resize can disable synchronized output and trigger restoration before the redraw completes. |
Sequence Diagram
sequenceDiagram
participant Pi
participant Terminal as Herdr terminal
participant Ghostty
Pi->>Terminal: Begin synchronized output + ED3
Terminal->>Terminal: Save offset from bottom
Terminal->>Ghostty: Apply ED3 and transcript redraw
opt Resize overlaps redraw
Terminal->>Ghostty: Resize using saved offset
end
Pi->>Terminal: End synchronized output
Terminal->>Ghostty: Restore saved viewport offset
Terminal->>Terminal: Request render
Reviews (1): Last reviewed commit: "fix: preserve Pi scroll position across ..." | Re-trigger Greptile
|
please see my comment on your issue i don't want to bring flaky detection if upstream pi gonan fix it. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pane/terminal.rs (1)
1113-1147: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftHoist
foreground_job()out of the core lockforeground_job()can snapshot the process table / walk process groups, so holdingself.coreacross this lookup can blockrender()and resize handling. Snapshot the needed state, drop the lock, then queryforeground_job(), and reacquire the lock for the rest of the byte handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 082735bc-c033-460b-8367-5bbfa5dfd0d6
📒 Files selected for processing (2)
src/pane/osc.rssrc/pane/terminal.rs
|
Understood, thanks for the context. I’ll keep this as a local compatibility patch for now and revisit it after Pi releases the experimental alternate-screen renderer. |
Summary
Testing
just cioffset_from_bottomat232, with stable scrollback size and visible-content hash for each widthRefs #2082
No public documentation update is needed; this restores the expected resize behavior.