[APP-5057] Add Cmd editor shortcuts to the TUI - #14517
Merged
Merged
Conversation
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
force-pushed
the
factory/app-5057-tui-cmd-hotkeys
branch
from
July 30, 2026 19:10
83d7c64 to
3505647
Compare
harryalbert
approved these changes
Jul 30, 2026
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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+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
Testing
Fail-before:
shared_editor_registers_additive_cmd_bindingsfailed becausecmd-awas 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 currentmaster.CARGO_INCREMENTAL=0 cargo clippy -p warp_tui --all-targets --tests -- -D warnings: passed after merging currentmaster.CARGO_BUILD_JOBS=2 cargo build -p warp_tui --bin warp-tui-oss: passed../script/formatandgit 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
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
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 intendedTuiEditorCommand../script/format, focused Clippy, and all 852warp_tuitests after merging the currentmaster.