fix(tui): use command shortcuts on macOS

Make the Ink TUI match macOS keyboard expectations: Command handles copy and common editor/session shortcuts, while Control remains reserved for interrupt/cancel flows. Update the visible hotkey help to show platform-appropriate labels.
This commit is contained in:
kshitijk4poor 2026-04-19 12:01:36 +05:30 committed by kshitij
parent dcd763c284
commit 8c9fdedaf5
4 changed files with 65 additions and 29 deletions

View file

@ -1,16 +1,21 @@
import { isMac } from '../lib/platform.js'
const mod = isMac ? 'Cmd' : 'Ctrl'
const pasteMod = isMac ? 'Cmd' : 'Alt'
export const HOTKEYS: [string, string][] = [
['Ctrl+C', 'interrupt / clear draft / exit'],
['Ctrl+D', 'exit'],
['Ctrl+G', 'open $EDITOR for prompt'],
['Ctrl+L', 'new session (clear)'],
['Alt+V / /paste', 'paste clipboard image'],
[mod + '+C / ' + mod + '+Shift+C', 'copy selection'],
[mod + '+D', 'exit'],
[mod + '+G', 'open $EDITOR for prompt'],
[mod + '+L', 'new session (clear)'],
[pasteMod + '+V / /paste', 'paste clipboard image'],
['Tab', 'apply completion'],
['↑/↓', 'completions / queue edit / history'],
['Ctrl+A/E', 'home / end of line'],
['Ctrl+Z / Ctrl+Y', 'undo / redo input edits'],
['Ctrl+W', 'delete word'],
['Ctrl+U/K', 'delete to start / end'],
['Ctrl+←/→', 'jump word'],
[mod + '+A/E', 'home / end of line'],
[mod + '+Z / ' + mod + '+Y', 'undo / redo input edits'],
[mod + '+W', 'delete word'],
[mod + '+U/K', 'delete to start / end'],
[mod + '+←/→', 'jump word'],
['Home/End', 'start / end of line'],
['Shift+Enter / Alt+Enter', 'insert newline'],
['\\+Enter', 'multi-line continuation (fallback)'],