Copy and cut the current line when nothing is selected in embedded code editors (AI blocks, diff views, etc.)
Pre-submit Checks
- I have searched Warp feature requests and there are no duplicates
- I have searched Warp docs and my feature is not there
Describe the solution you'd like?
Extend the line-wise copy (#15849, implemented in #15969) and cut (#15968) behavior to the code editors embedded in other surfaces, not just the standalone file editor. When nothing is selected in one of these embedded editors, Cmd/Ctrl+C and Cmd/Ctrl+X should copy/cut the current line the same way the standalone file editor now does, and paste should put it back as a whole line. The goal is for these shortcuts to behave the same way in every mode, rather than differing by which surface happens to hold the code editor.
The surfaces in question are every other place CodeEditorView is embedded:
- AI blocks (code shown inline in an agent response)
- Diff views
- The requested-command view
- The CLI subagent block
Is your feature request related to a problem? Please describe.
Yes. Current Ctrl/Cmd+X behavior in all of these embedded surfaces (and, before #15968 lands, in the standalone editor too): with nothing selected, cut removes the last character before the cursor and copies nothing useful to the clipboard. CodeEditorModel::cut is copy then backspace, and copying an empty selection writes empty text to the clipboard, clearing whatever was there.
#15849 and #15968 fix this, but only for the standalone file editor (CodeView in app/src/code/view.rs), gated behind CodeEditorView::with_copy_line_when_selection_is_empty. Every embedded editor keeps the old behavior. Once the standalone editor behaves like VS Code/Zed and the embedded ones don't, the same shortcut does two different things depending on which surface you're in, which is confusing on its own and easy to run into once users get used to the fixed behavior.
Additional context
This is a deliberate follow-up, not an oversight in #15849 / #15969 / #15968. PR #15969 (the copy fix for the standalone file editor) restricts its scope on purpose: it states, "That restriction is the point of the change rather than an afterthought." Every embedded editor currently relies on the copy shortcut emitting CodeEditorEvent::CopiedEmptyText so its parent view can copy its own selection instead — for example, an AI block owner copying the whole block (see #13918, which asks for a plain "Copy Output" option there).
So extending this feature to embedded surfaces isn't just calling the same builder method (with_copy_line_when_selection_is_empty) at each construction site. Each parent needs its own decision about whether it still wants that copy-empty-text fallback, or whether a line-wise copy/cut of the embedded editor's own current line should take priority when nothing is selected. That per-surface decision is why this is a separate feature request and PR rather than folded into #15968.
Operating system (OS)
Cross-platform
How important is this feature to you?
2
Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1
None
Source: warpdotdev/warp