Skip to content

feat(desktop): add scroll to bottom for terminal#653

Merged
saddlepaddle merged 2 commits intomainfrom
zany-urial-63939d
Jan 7, 2026
Merged

feat(desktop): add scroll to bottom for terminal#653
saddlepaddle merged 2 commits intomainfrom
zany-urial-63939d

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Jan 7, 2026

Summary

  • Add Cmd+Shift+Down (Ctrl+Shift+Down on Windows/Linux) hotkey to scroll terminal to bottom
  • Add "Scroll to Bottom" option to terminal right-click context menu with hotkey displayed
  • Uses xterm.js's built-in scrollToBottom() method

Implementation

  • Added SCROLL_TO_BOTTOM hotkey definition to shared hotkeys
  • Extended terminal callbacks store with scroll-to-bottom callback registration
  • Registered hotkey handler in Terminal component (only active when focused)
  • Added context menu item with icon and hotkey shortcut display

Test plan

  • Start desktop app
  • Open terminal and generate scrollback history
  • Scroll up, then press Cmd+Shift+Down to jump to bottom
  • Right-click and verify "Scroll to Bottom" appears with hotkey shown
  • Verify works in split panes independently
  • Typecheck passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a "Scroll to Bottom" action to terminal content, accessible from the context menu.
    • Added a keyboard shortcut (Cmd/Ctrl+Shift+Down) to jump to the latest terminal output when the terminal is focused.
    • Context menu displays the assigned shortcut next to the new action for quick discovery.

✏️ Tip: You can customize this high-level summary in your review settings.

Add Cmd+Shift+Down hotkey and context menu option to quickly jump to
the bottom of terminal output. Useful for returning to current prompt
after scrolling through command history.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

This PR adds a "Scroll to Bottom" terminal action: new hotkey (meta+shift+down), context-menu item, terminal callback registration/unregistration, and wiring through the terminal-callbacks store so panes can invoke scroll-to-bottom behavior.

Changes

Cohort / File(s) Summary
Hotkey Definition
apps/desktop/src/shared/hotkeys.ts
Added SCROLL_TO_BOTTOM hotkey (keys: "meta+shift+down", category "Terminal", label/description added).
Store State Management
apps/desktop/src/renderer/stores/tabs/terminal-callbacks.ts
Added scrollToBottomCallbacks: Map<string, () => void> plus registerScrollToBottomCallback, unregisterScrollToBottomCallback, and getScrollToBottomCallback actions and initialization.
Terminal Component
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
Registers/unregisters scroll-to-bottom callback in lifecycle; implements handler that calls xterm.scrollToBottom() and honors global SCROLL_TO_BOTTOM hotkey when terminal focused.
Context Menu UI
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabContentContextMenu.tsx
Added onScrollToBottom prop, new "Scroll to Bottom" menu item with LuArrowDownToLine icon, and conditional shortcut display.
Tab Pane Wiring
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/TabPane.tsx
Added handleScrollToBottom that calls getScrollToBottomCallback(paneId) and passes it to TabContentContextMenu via onScrollToBottom.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User
    participant UI as TabPane / ContextMenu
    participant Store as TerminalCallbacksStore
    participant Terminal
    participant XTerm

    rect rgb(240,248,255)
    Note right of Terminal: Terminal lifecycle registers callback
    Terminal->>Store: registerScrollToBottomCallback(paneId, callback)
    end

    alt Keyboard shortcut pressed (meta+shift+down)
        User->>Terminal: press hotkey
        Terminal->>Terminal: hotkey handler checks focus
        Terminal->>XTerm: xterm.scrollToBottom()
    else User selects context menu item
        User->>UI: click "Scroll to Bottom"
        UI->>Store: getScrollToBottomCallback(paneId)
        Store-->>UI: return callback
        UI->>Terminal: invoke callback()
        Terminal->>XTerm: xterm.scrollToBottom()
    end

    rect rgb(240,255,240)
    Note right of Terminal: Terminal unregisters callback on teardown
    Terminal->>Store: unregisterScrollToBottomCallback(paneId)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰
Down the tunnel, paws a-tap, I hop—
A shortcut, a click, and logs drop.
Callback stitched, menu in sight,
Scroll to bottom, everything's right.
Hop, scroll, rejoice—nibbles of light ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a scroll-to-bottom feature for the desktop terminal.
Description check ✅ Passed The pull request description covers the summary, implementation, and test plan, though it lacks formal sections from the template like explicit Related Issues and Type of Change.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9db2741 and c6e16cd.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/stores/tabs/terminal-callbacks.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/renderer/stores/tabs/terminal-callbacks.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build

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 and usage tips.

@saddlepaddle saddlepaddle merged commit 72d19fb into main Jan 7, 2026
5 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 7, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

@Kitenite Kitenite deleted the zany-urial-63939d branch January 8, 2026 01:52
saddlepaddle added a commit that referenced this pull request Jan 10, 2026
* feat(desktop): add scroll to bottom for terminal

Add Cmd+Shift+Down hotkey and context menu option to quickly jump to
the bottom of terminal output. Useful for returning to current prompt
after scrolling through command history.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* style: fix biome formatting for terminal-callbacks

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai coderabbitai Bot mentioned this pull request Jan 18, 2026
5 tasks
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.

1 participant