Skip to content

feat(terminal): add Cmd+Arrow for cursor line navigation#926

Merged
Kitenite merged 1 commit into
superset-sh:mainfrom
chasemcdo:terminal-text-on-cmd-arrow
Jan 25, 2026
Merged

feat(terminal): add Cmd+Arrow for cursor line navigation#926
Kitenite merged 1 commit into
superset-sh:mainfrom
chasemcdo:terminal-text-on-cmd-arrow

Conversation

@chasemcdo
Copy link
Copy Markdown
Contributor

@chasemcdo chasemcdo commented Jan 23, 2026

Summary

  • Frees up Cmd+Arrow for terminal cursor navigation (beginning/end of line)
  • Remaps terminal tab switching to Cmd+Option+Left/Right
  • Remaps pane switching to Cmd+Shift+Left/Right

Changes

  • apps/desktop/src/shared/hotkeys.ts: Updated keybindings for terminal/pane switching
  • apps/desktop/src/renderer/.../Terminal/helpers.ts: Added Cmd+Left (Ctrl+A) and Cmd+Right (Ctrl+E) handlers

Test plan

  • Open a workspace with a terminal
  • Type some text in the terminal
  • Press Cmd+Left → cursor jumps to beginning of line
  • Press Cmd+Right → cursor jumps to end of line
  • Verify Cmd+Option+Left/Right switches between terminal tabs
  • Verify Cmd+Shift+Left/Right switches between panes

Summary by CodeRabbit

  • New Features

    • Added Cmd+Left and Cmd+Right in the terminal to jump to the start or end of the current line.
  • Changes

    • Updated navigation shortcuts: terminal switching now uses Meta+Alt+Left/Right; pane switching now uses Meta+Shift+Left/Right.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

Adds Cmd+Left and Cmd+Right handling in the terminal keyboard handler to send Ctrl+A/Ctrl+E via onWrite, and remaps several global hotkeys to include different modifier combinations to avoid conflicts with terminal line navigation.

Changes

Cohort / File(s) Summary
Terminal keyboard handler
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/helpers.ts
Added handling for Meta+ArrowLeft and Meta+ArrowRight that call onWrite with Ctrl+A and Ctrl+E respectively (keydown), returning false to stop further processing. Inserted after existing Cmd+Backspace branch.
Hotkey definitions
apps/desktop/src/shared/hotkeys.ts
Remapped navigation hotkeys: PREV_TERMINAL and NEXT_TERMINAL changed to meta+alt+left/right; PREV_PANE and NEXT_PANE changed from meta+alt+left/right to meta+shift+left/right.

Sequence Diagram(s)

(omitted)

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly Related PRs

Suggested Reviewers

  • Kitenite

Poem

🐰 Cmd and arrows tap-tap, off I hop,
Ctrl+A and E make the cursor stop,
Alt and Shift rearrange the dance,
No more clashes — give the keys a chance! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive All changes are directly related to the stated objective of resolving the keybinding conflict. However, the PR objectives mention Cmd+Option+Up/Down for pane switching while the hotkeys.ts summary shows meta+shift for pane navigation, indicating a discrepancy. Clarify whether pane switching uses Cmd+Option+Up/Down or Cmd+Shift+Up/Down, as the PR objectives and file changes show conflicting information.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Cmd+Arrow keyboard shortcuts for cursor line navigation in the terminal, which is the primary objective of this PR.
Description check ✅ Passed The description covers the key aspects: summary of changes, specific file modifications, and a comprehensive test plan. It addresses the core objectives without major gaps.
Linked Issues check ✅ Passed The PR successfully addresses issue #911 by remapping terminal/pane switching to Cmd+Option+Arrow and adding Cmd+Arrow handlers for cursor navigation in the terminal.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Frees up Cmd+Arrow for terminal cursor navigation by:
- Remapping terminal switching from Cmd+Arrow to Cmd+Option+Arrow
- Remapping pane switching from Cmd+Option+Arrow to Cmd+Shift+Arrow
- Adding keyboard handlers for Cmd+Left (beginning of line) and
  Cmd+Right (end of line) that send Ctrl+A and Ctrl+E respectively

This matches expected macOS behavior where Cmd+Arrow moves to line
boundaries, similar to browsers and IDEs.
@chasemcdo chasemcdo force-pushed the terminal-text-on-cmd-arrow branch from 1c5f595 to 3528510 Compare January 23, 2026 22:50
@Kitenite Kitenite merged commit 0d20ed8 into superset-sh:main Jan 25, 2026
5 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.

2 participants