-
Notifications
You must be signed in to change notification settings - Fork 122
Add Jupyter-style keybindings for undo, redo, and cell commands #10066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
E2E Tests 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Jupyter-style keyboard shortcuts for notebook cell operations, replacing traditional OS-specific shortcuts (Cmd/Ctrl+C/X/V/Z) with single-key shortcuts (C/X/V/Z) that only work in command mode when no cell editor is focused.
Key Changes
- Adds single-key shortcuts (Z, Shift+Z, C, X, V, Shift+V) for undo/redo and cell copy/cut/paste operations
- Implements command mode detection using
POSITRON_NOTEBOOK_EDITOR_CONTAINER_FOCUSEDand negatedPOSITRON_NOTEBOOK_CELL_EDITOR_FOCUSEDcontext keys - Removes OS-specific keybinding modifiers (CtrlCmd) from cell operation commands
src/vs/workbench/contrib/positronNotebook/browser/positronNotebook.contribution.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/positronNotebook/browser/positronNotebook.contribution.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/positronNotebook/browser/positronNotebook.contribution.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/positronNotebook/browser/positronNotebook.contribution.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
src/vs/workbench/contrib/positronNotebook/browser/positronNotebook.contribution.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/positronNotebook/browser/positronNotebook.contribution.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/positronNotebook/browser/positronNotebook.contribution.ts
Show resolved
Hide resolved
b3fe926 to
641e023
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes worked well for me! Looks good once the conflict is resolved.
I did want to ask about this comment in the PR description:
Press Esc to enter command mode (cell should have blue border, not green)
I don't see a green border around the cells at any point, is that supposed to be the case?
One thing I did notice while testing these keybindings is that its a bit annoying to do a sequence of actions like copy + paste because of how we automatically enter edit mode when we add a new cell to the notebook. The sequence to copy and paste a cell ends up being C, Escape, V.
I'm wondering if we should revisit that notion? Doesn't have to be in this PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I agree with @dhruvisompura it shouldn't enter edit mode when new cells are added. Jupyter Lab behaves the way we're suggesting as well
641e023 to
18cb0d7
Compare
|
@seeM and @dhruvisompura Re: the entering-edit-mode annoyance #10120 |
Addresses #3014.
This PR implements Jupyter-style keyboard shortcuts for cell-level undo, redo, copy, cut, and paste operations in Positron Notebooks. These shortcuts match standard Jupyter behavior and work when in command mode (notebook focused but not editing a cell).
Followup to #2357.
Implemented shortcuts:
These shortcuts only activate when the notebook container is focused but no cell editor is focused (command mode), ensuring they don't interfere with normal text editing.
Release Notes
New Features
Bug Fixes
QA Notes
@:notebooks