Walkthrough
Adds platform-aware terminal navigation shortcut handling via a new terminalNavigationShortcutData export and integrates it into the terminal drawer, which now routes navigation and clear shortcuts through a generalized sendTerminalInput function.
Changes
| Cohort / File(s) | Summary |
|---|---|
Keybindings Module apps/web/src/keybindings.ts, apps/web/src/keybindings.test.ts | Adds terminalNavigationShortcutData(event, platform) and tests; extends ShortcutEventLike with optional type; enforces keydown-only handling and maps arrow+modifier combos to terminal navigation sequences (word/line moves) with platform-specific rules. |
Terminal Drawer Integration apps/web/src/components/ThreadTerminalDrawer.tsx | Replaces specialized clear handler with a generalized sendTerminalInput(data, fallbackError) and integrates terminalNavigationShortcutData to intercept navigation shortcuts, prevent default, stop propagation, and send navigation sequences to the terminal. |
Sequence Diagram
| 1 | sequenceDiagram |
| 2 | actor User |
| 3 | participant Drawer as ThreadTerminalDrawer |
| 4 | participant Keybindings |
| 5 | participant Terminal as TerminalViewport |
| 6 | |
| 7 | User->>Drawer: Press arrow key + modifier |
| 8 | Drawer->>Keybindings: terminalNavigationShortcutData(event, platform) |
| 9 | alt Navigation shortcut detected |
| 10 | Keybindings-->>Drawer: Return navigation sequence |
| 11 | Drawer->>Drawer: preventDefault & stopPropagation |
| 12 | Drawer->>Drawer: sendTerminalInput(sequence, "Failed to move cursor") |
| 13 | Drawer->>Terminal: Write navigation data |
| 14 | Terminal-->>User: Cursor moves |
| 15 | else No shortcut match |
| 16 | Keybindings-->>Drawer: Return null |
| 17 | Drawer->>Drawer: Continue to other handlers (clear shortcut, default) |
| 18 | end |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Title check | ⚠️ Warning | The PR title 'Improve terminal navigation shortcuts and streamline git action PR flow' is overly broad and vague. The actual changes focus on adding terminal navigation shortcuts and refactoring terminal input handling, but the 'streamline git action PR flow' portion is not present in the changeset. | Consider revising the title to focus on the core change: 'Add terminal navigation shortcuts support' or 'Refactor terminal shortcuts with navigation support', removing the unrelated 'git action PR flow' reference. |
| 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 |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Merge Conflict Detection | ✅ Passed | ✅ No merge conflicts detected when merging into main |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
codething/70a71c65
Comment @coderabbitai help to get the list of available commands and usage tips.