Today there's no way to remove a queued message — ↑ loads it for edit, ctrl-K dispatches the head, but a draft you no longer want stays put forever. ctrl-C just clears the composer and exits edit mode without touching the queue. Two new bindings, both gated on queueEditIdx !== null so they're inert when the user isn't pointing at a queue item: - ctrl-X — delete the queue item being edited, clear composer, exit edit mode. "cut" matches the mental model and doesn't collide with any existing binding. - esc — cancel the edit (composer clears, item stays in queue). Mirrors ctrl-C's existing behavior so muscle memory has two paths. Header line now reads `queued (3) · editing 2 · ⌃X delete · esc cancel` when in edit mode, so the affordance is discoverable without /help. The /help hotkey table also gets a Ctrl+X entry. ctrl-C is intentionally unchanged: it should never destroy queued content. Cancel is non-destructive (esc / ctrl-C); only ctrl-X removes the item.
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import { isMac, isRemoteShell } from '../lib/platform.js'
|
||
|
||
const action = isMac ? 'Cmd' : 'Ctrl'
|
||
const paste = isMac ? 'Cmd' : 'Alt'
|
||
|
||
const copyHotkeys: [string, string][] = isMac
|
||
? [
|
||
['Cmd+C', 'copy selection'],
|
||
['Ctrl+C', 'interrupt / clear draft / exit']
|
||
]
|
||
: isRemoteShell()
|
||
? [
|
||
['Cmd+C', 'copy selection when forwarded by the terminal'],
|
||
['Ctrl+C', 'copy selection / interrupt / clear draft / exit']
|
||
]
|
||
: [['Ctrl+C', 'copy selection / interrupt / clear draft / exit']]
|
||
|
||
export const HOTKEYS: [string, string][] = [
|
||
...copyHotkeys,
|
||
[action + '+D', 'exit'],
|
||
[action + '+G / Alt+G', 'open $EDITOR (Alt+G fallback for VSCode/Cursor)'],
|
||
[action + '+L', 'redraw / repaint'],
|
||
[paste + '+V / /paste', 'paste text; /paste attaches clipboard image'],
|
||
['Tab', 'apply completion'],
|
||
['↑/↓', 'completions / queue edit / history'],
|
||
['Ctrl+X', 'delete the queued message you’re editing (esc cancels edit)'],
|
||
[action + '+A/E', 'home / end of line'],
|
||
[action + '+Z / ' + action + '+Y', 'undo / redo input edits'],
|
||
[action + '+W', 'delete word'],
|
||
[action + '+U/K', 'delete to start / end'],
|
||
[action + '+←/→', 'jump word'],
|
||
['Home/End', 'start / end of line'],
|
||
['Shift+Enter / Alt+Enter', 'insert newline'],
|
||
['\\+Enter', 'multi-line continuation (fallback)'],
|
||
['!<cmd>', 'run a shell command (e.g. !ls, !git status)'],
|
||
['{!<cmd>}', 'interpolate shell output inline (e.g. "branch is {!git branch --show-current}")']
|
||
]
|