fix(terminal): coalesce scroll events#184
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughScroll handling now uses shared delta helpers, queued scroll coalescing, and a dedicated app-loop path. The render tests were expanded to cover scroll mapping, queue handling, dirty-frame drawing, resize processing, and the new scrollable test app helper. ChangesScroll coalescing feature
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant App
participant handleLoopEvent
participant handleScrollLoopEvent
participant coalesceScrollEvents
participant Transcript
App->>handleLoopEvent: incoming tcell event
handleLoopEvent->>handleLoopEvent: scrollDeltaForEvent(event)
handleLoopEvent->>handleScrollLoopEvent: scroll delta
handleScrollLoopEvent->>coalesceScrollEvents: coalesce(delta)
coalesceScrollEvents-->>handleScrollLoopEvent: aggregated delta, pending event
handleScrollLoopEvent->>Transcript: scrollTranscript(delta)
handleScrollLoopEvent->>App: draw()
handleScrollLoopEvent->>handleLoopEvent: handleLoopEvent(pending) if present
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #184 +/- ##
==========================================
+ Coverage 82.95% 83.53% +0.57%
==========================================
Files 287 287
Lines 23166 23204 +38
==========================================
+ Hits 19218 19383 +165
+ Misses 2792 2658 -134
- Partials 1156 1163 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/terminal/app.go`:
- Around line 420-427: The pending event handling in app.handleLoopEvent is
discarding the dirty result, so redraw requests from coalesced.Pending can be
lost after the scroll draw. Update the return path in the loop that processes
coalesced.Pending to capture and propagate the dirty flag from handleLoopEvent
alongside shouldQuit, and ensure the function’s final return reflects that
pending-event mutation. Use app.handleLoopEvent and the coalesced.Pending branch
as the key places to update.
In `@internal/terminal/scroll.go`:
- Around line 55-64: The scrollDeltaForEvent helper currently only gates mouse
scrolling by mode, so PageUp/PageDown key events can still be consumed outside
chat mode before normal dispatch. Update scrollDeltaForEvent, together with
keyScrollDelta if needed, to apply the same modeChat guard to keyboard-based
scroll extraction so non-chat modes continue through handleLoopEvent’s normal
event handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5cdc3dc3-e799-4ff3-a8ac-14ca5778d993
📒 Files selected for processing (3)
internal/terminal/app.gointernal/terminal/render_internal_test.gointernal/terminal/scroll.go
dbe6350 to
8b2581d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/terminal/render_internal_test.go`:
- Around line 794-814: The dirty-frame test is asserting the same expected value
for both subtests, so the “dirty frame draws” case never validates the true
path. Update TestDrawDirtyFrame to use the testCase.dirty value in the assertion
against app.drawDirtyFrame, or split the clean and dirty expectations so the
behavior is checked separately.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 98983039-ab97-44d2-895f-8a6aafd83fcb
📒 Files selected for processing (3)
internal/terminal/app.gointernal/terminal/render_internal_test.gointernal/terminal/scroll.go
🚧 Files skipped from review as they are similar to previous changes (2)
- internal/terminal/scroll.go
- internal/terminal/app.go
|



Summary
Validation