fix(modal): propagate body view keymap context so editor bindings work inside modals (#13067)#13126
fix(modal): propagate body view keymap context so editor bindings work inside modals (#13067)#13126ther12k wants to merge 1 commit into
Conversation
…ork inside modals
The generic Modal<T> wrapper lacked a keymap_context override. Its
default View trait implementation returned only {"Modal"}, which meant
keybindings gated on other identifiers (e.g. id!("EditorView") for
paste/copy/cut) could not match when an EditorView inside a modal was
focused.
Add a keymap_context method that extends the modal's own context with
the body view's context, preserving the "Modal" identifier (needed for
the Escape-to-close binding) while also exposing identifiers from
child views such as "EditorView".
Fixes paste (Ctrl+V / Cmd+V), copy (Ctrl+C / Cmd+C), and cut
(Ctrl+X / Cmd+X) in modal-hosted text fields:
- Add/Edit Custom Endpoint dialog fields
- Warp Agent settings API key field
- Any modal that wraps EditorView instances
References:
- warpdotdev#13067
- warpdotdev#7694
CHANGELOG-BUG-FIX: Fixed paste and copy not working in settings modal text fields
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @ther12k on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
Every PR must be linked to a same-repo issue before Oz can review it. This PR is linked to #13067, but no linked issue is marked See the contribution guidelines for the full readiness model. Powered by Oz |
There was a problem hiding this comment.
Every PR must be linked to a same-repo issue before Oz can review it.
This PR is linked to #13067, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.
See the contribution guidelines for the full readiness model.
Powered by Oz
|
Per CONTRIBUTING.md:
This is a straightforward UI bug fix (paste/copy not working in modal text fields). The issue was initially auto-labeled Requesting |
Description
Modal-hosted text fields (e.g. the Add Custom Endpoint dialog, API key fields in agent settings) do not support Ctrl+V / Cmd+V paste, Ctrl+C / Cmd+C copy, or right-click context menu operations.
Root cause
The generic
Modal<T>wrapper did not override thekeymap_contextmethod on itsViewimpl. The default trait implementation returns only{"Modal"}, which means keybindings gated on identifiers from child views (e.g.id!("EditorView")for paste/copy/cut) can never match when an EditorView is focused inside a modal.This affects both:
CustomAction::Paste,CustomAction::Copy,CustomAction::Cut) — registered withid!("EditorView") & !id!("IMEOpen")StandardAction::Paste) — also gated onid!("EditorView")Fix
Added a
keymap_contextoverride toModal<T>that extends the modal's own context ("Modal") with the body view's context (e.g."CustomEndpointModal","EditorView", etc.). This preserves the modal's Escape-to-close binding (gated on"Modal") while also exposing child view identifiers for their keybindings.Testing
cargo check -p warp_apppassesManual verification
Screenshots / Videos
Before: Ctrl+V in endpoint name field inserts only the 'v' character
After: Ctrl+V pastes the full clipboard content
Tested on: Linux (X11/Wayland)
Linked Issue
ready-to-implement.Closes #13067
Related: #7694
Changelog
CHANGELOG-BUG-FIX: Fixed paste and copy not working in settings modal text fields