Skip to content

Fix copy shortcut in macOS notebook cells - #59431

Merged
dinocosta merged 4 commits into
zed-industries:mainfrom
ChengranAA:notebook-copy-paste
Jun 16, 2026
Merged

Fix copy shortcut in macOS notebook cells#59431
dinocosta merged 4 commits into
zed-industries:mainfrom
ChengranAA:notebook-copy-paste

Conversation

@ChengranAA

@ChengranAA ChengranAA commented Jun 16, 2026

Copy link
Copy Markdown

Fix cmd-c not copying text inside macOS notebook cell editors.

Previously, the macOS notebook keymap bound cmd-c to notebook::InterruptKernel in notebook contexts, including NotebookEditor > Editor. This shadowed the normal editor copy shortcut while editing notebook cells.

Solution

Move the macOS notebook interrupt shortcut from cmd-c to ctrl-c.

This keeps the notebook interrupt shortcut available while allowing the normal editor keybindings to handle:

  • cmd-c for copy
  • cmd-x for cut
  • cmd-v for paste

inside notebook cell editors.

  • This change is macOS-specific.

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 16, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jun 16, 2026
ChengranAA and others added 3 commits June 16, 2026 17:11
Remove all bindings of `notebook::InterruptKernel` for the
`NotebookEditor > Editor` context.

The original change was simply updating the default macOS keymap to use
`ctrl-c` instead of `cmd-c` in order to avoid breaking copy behavior
while focused on an editor. Although this was fine for macOS, the issue
would still be present on both Windows and Linux, where `ctrl-c` is
bound to `editor::Copy` by default, but was now bound to
`notebook::InterruptKernel` on `NotebookEditor > Editor`.

As such, in order to avoid this issue in any platform, this commit
removes any of the `cmd-c`/`ctrl-c` binds to `notebook::InterruptKernel`
in the `NotebookEditor > Editor` in order for it to match the default
`Editor` context instead and simply copy the selection if the user is
focused on an editor.

@dinocosta dinocosta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ChengranAA ! Thank you for finding and attempting to fix this 🙂

Although the changes were good on macOS, the issue would still be present on both Windows and Linux, as those platforms rely on ctrl-c for copying. I've updated the changes to remove any cmd-c/ctrl-c binding in the NotebookEditor > Editor context, which will let it match on the default Editor context and ensure copy works on any platform, if the user is on a notebook but focused on an editor.

Thanks!

@dinocosta dinocosta self-assigned this Jun 16, 2026
@dinocosta dinocosta added area:controls/keybinds Keyboard shortcuts, mapping, binding, keymaps, etc area:repl repl, jupyter, notebooks, etc labels Jun 16, 2026
@dinocosta
dinocosta enabled auto-merge June 16, 2026 15:46
@dinocosta
dinocosta added this pull request to the merge queue Jun 16, 2026
Merged via the queue into zed-industries:main with commit ea673ff Jun 16, 2026
50 checks passed
This was referenced Jun 18, 2026
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Fix `cmd-c` not copying text inside macOS notebook cell editors.

Previously, the macOS notebook keymap bound `cmd-c` to
`notebook::InterruptKernel` in notebook contexts, including
`NotebookEditor > Editor`. This shadowed the normal editor copy shortcut
while editing notebook cells.


## Solution

Move the macOS notebook interrupt shortcut from `cmd-c` to `ctrl-c`.

This keeps the notebook interrupt shortcut available while allowing the
normal editor keybindings to handle:

- `cmd-c` for copy
- `cmd-x` for cut
- `cmd-v` for paste

inside notebook cell editors.
- This change is macOS-specific.

Release Notes:

- N/A

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:controls/keybinds Keyboard shortcuts, mapping, binding, keymaps, etc area:repl repl, jupyter, notebooks, etc cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants