Skip to content

[APP-5057] Add Cmd editor shortcuts to the TUI - #14517

Merged
harryalbert merged 3 commits into
masterfrom
factory/app-5057-tui-cmd-hotkeys
Jul 30, 2026
Merged

[APP-5057] Add Cmd editor shortcuts to the TUI#14517
harryalbert merged 3 commits into
masterfrom
factory/app-5057-tui-cmd-hotkeys

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

Adds familiar Cmd-based editing shortcuts to the shared TUI editor binding set, covering both the agent input and reusable TUI editor surfaces without changing any existing binding:

  • Cmd+A/C/V/X/Z and Cmd+Shift+Z for select all, copy, OS-clipboard paste, cut, undo, and redo.
  • Cmd+Left/Right and Cmd+Shift+Left/Right for visual-line movement and selection.
  • Cmd+Backspace for delete-to-line-start.
  • A TUI-specific binding-validator allowance so Super/Cmd chords work on every OS where enhanced terminal keyboard reporting provides them, without changing GUI validation or behavior.

Cmd+Delete remains intentionally unbound because terminal input cannot represent it portably (an existing regression test enforces this). The optional buffer-top/bottom and clear-lines chords remain out of scope because the shared TUI editor has no corresponding commands. No proposed must-have chord collided with an existing TUI binding; all legacy Ctrl/Alt/Home/End bindings remain registered.

Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1785370335034379

Linked Issue

  • APP-5057
  • The ticket is gated for this spec-skipped implementation.
  • Visual proof is included below.

Testing

  • Fail-before: shared_editor_registers_additive_cmd_bindings failed because cmd-a was absent.

  • Focused regression suite: 5/5 passed (binding registration, paste insertion/empty/dispatch, and line selection).

  • env -u WARP_API_KEY CARGO_BUILD_JOBS=2 cargo nextest run -p warp_tui: 852/852 passed after merging current master.

  • CARGO_INCREMENTAL=0 cargo clippy -p warp_tui --all-targets --tests -- -D warnings: passed after merging current master.

  • CARGO_BUILD_JOBS=2 cargo build -p warp_tui --bin warp-tui-oss: passed.

  • ./script/format and git diff --check: passed.

  • ./script/presubmit: formatting and all documented Clippy phases passed; the workspace test phase could not complete in this cloud runner because unrelated environment tests failed (root-only sudo expectation, external harness HTTP 501 responses, and missing XDG runtime), after an initial run also exhausted the sandbox build-artifact quota. The touched-crate suite above passed independently.

  • Live authenticated TUI: enhanced-keyboard Cmd+A selected cmd hotkey roundtrip, Cmd+X cut it to the OS clipboard, and Cmd+V restored it; the recording also exercises Cmd+Z and Cmd+Shift+Z.

  • I manually tested the running TUI with warp-tui-oss.

Screenshots / Videos

View the implementation run, screenshot, and video artifacts.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-IMPROVEMENT: Added familiar Cmd-based editing shortcuts to Warp Agent CLI input.

Co-Authored-By: Warp agent@warp.dev
Co-Authored-By: Oz oz-agent@warp.dev

Rework changes

  • Added cmd_bindings_dispatch_expected_editor_commands, which dispatches Cmd+A/C/V/X/Z and Cmd+Shift+Z through the registered keymap and verifies that each chord produces its intended TuiEditorCommand.
  • The standalone Cmd+C visual-proof finding was explicitly waived by the requester in the originating Slack thread; the existing proof is unchanged.
  • Revalidated with ./script/format, focused Clippy, and all 852 warp_tui tests after merging the current master.

@cla-bot cla-bot Bot added the cla-signed label Jul 30, 2026
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review July 30, 2026 02:11
@warp-agent-staging
warp-agent-staging Bot requested a review from harryalbert July 30, 2026 02:11
oz-agent and others added 2 commits July 30, 2026 13:58
Co-Authored-By: Warp <agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Warp <agent@warp.dev>

Co-Authored-By: Oz <oz-agent@warp.dev>
@harryalbert
harryalbert force-pushed the factory/app-5057-tui-cmd-hotkeys branch from 83d7c64 to 3505647 Compare July 30, 2026 19:10

Copy link
Copy Markdown
Contributor

This stack of pull requests is managed by Graphite. Learn more about stacking.

@harryalbert
harryalbert merged commit a1eeff9 into master Jul 30, 2026
42 of 44 checks passed
@harryalbert
harryalbert deleted the factory/app-5057-tui-cmd-hotkeys branch July 30, 2026 20:23
jwp2987 pushed a commit to jwp2987/phosphor that referenced this pull request Aug 16, 2026
…ackspace)

Upstream a1eeff9 ("[APP-5057] Add Cmd editor shortcuts to the TUI",
warpdotdev#14517), 2026-07-30 — completing a partial port.

Most of that commit is already here: `TuiEditorCommand::Paste` and its
`TuiEditorInteractionOutcome::Paste` route, `SelectToLineStart` /
`SelectToLineEnd`, `clipboard::read_from_clipboard`, `apply_editor_paste`
/ `apply_editor_paste_with`, the `is_tui_binding_cross_platform`
validator override, and the `cmd-c` / `cmd-x` / `cmd-v` /
`cmd-shift-left` / `cmd-shift-right` bindings. What was missing were the
six additive keys on already-registered commands, added here to match
upstream's `SHARED_EDITOR_BINDINGS` exactly:

  cmd-left      → MoveToLineStart      cmd-a         → SelectAll
  cmd-right     → MoveToLineEnd        cmd-z         → Undo
  cmd-backspace → KillToLineStart      cmd-shift-Z   → Redo

Deliberately NOT added: upstream's `cmd-delete` on `KillToLineEnd`. This
fork drops it with an in-source comment citing warpdotdev#14217 (it
panics the keybinding parser on Linux), and that divergence stands.

Registration risk, stated rather than assumed: `cmd-backspace` is the one
new key adjacent to that known-bad `cmd-delete`. It is not compile- or
test-verified here. If the parser rejects it, the existing
`tui_binding_registration_passes_the_cross_surface_validators` test fails
at `super::init`, so the batched suite run will surface it rather than a
user hitting it at startup.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VNUMjBVuwvEnRSgaawUCR3
jwp2987 pushed a commit to jwp2987/phosphor that referenced this pull request Aug 16, 2026
Upstream a1eeff9 ("[APP-5057] Add Cmd editor shortcuts to the TUI",
warpdotdev#14517), 2026-07-30 — completing fork commit 47c45f4, which landed the
six additive `cmd-` keys but none of the tests that guard them.

47c45f4 nominated `tui_binding_registration_passes_the_cross_surface_validators`
as its safety net. That test only proves `init` does not panic: a chord
registered against the wrong surface, or wired to the wrong command,
passes it silently. Upstream's two tests are what actually close that
gap, so they are ported here.

- `shared_editor_registers_additive_cmd_bindings` — asserts all eleven
  cmd chords are present on *both* `tui:input:*` and `tui:editor:*`, and
  that ctrl-shift-C / ctrl-z survive alongside them. This is the test
  that would catch `cmd-backspace` — the key 47c45f4 flagged as the
  registration risk, being adjacent to the known-bad `cmd-delete` — being
  dropped by the parser or the validator.
- `cmd_bindings_dispatch_expected_editor_commands` — dispatches each
  chord through the registered keymap into a `CommandRecorder` view
  sharing `TuiEditorView`'s ui_name, and asserts the resulting
  `TuiEditorCommand` discriminant. Registration alone cannot show a
  chord reaches its intended command; this does.

Also fixes a live breakage 47c45f4 left behind:
`keybinding_initializer_registers_line_start_for_input_and_editor`
asserts the move_to_line_start trigger set *by equality*, and adding
`cmd-left` to the binding table made that set a strict superset of the
expectation. Upstream updated the same assertion in the same commit; the
fork took the production half only. Its copy/cut assertions (which
upstream also extended, with cmd-c/cmd-x) never existed here, so they
are added in upstream's post-commit form — the fork's binding table is
byte-identical to upstream's for both commands.

Not ported: upstream's hunk in `keybindings_tests.rs`, which rewrites
`input_cut_binding_yields_ctrl_x_to_contextual_menu_clear` to account
for a second cut binding. That test does not exist in this fork, and
neither does the `INLINE_MENU_CAN_CLEAR_SELECTED_FLAG` context carve-out
for cut that it exercises — `context_for_editor_binding` has no such
case. Porting it would require a production change, which is out of
scope here.

Divergence preserved: `cmd-delete` on `KillToLineEnd` stays unbound
(warpdotdev#14217), and no ported assertion expects it.

Not compile-verified: no build, check, or test was run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VNUMjBVuwvEnRSgaawUCR3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants