Skip to content

Support Command shortcuts in Crumble on macOS#1065

Open
GautamNambiar wants to merge 12 commits into
quantumlib:mainfrom
GautamNambiar:crumble-mac-shortcuts
Open

Support Command shortcuts in Crumble on macOS#1065
GautamNambiar wants to merge 12 commits into
quantumlib:mainfrom
GautamNambiar:crumble-mac-shortcuts

Conversation

@GautamNambiar
Copy link
Copy Markdown

Adds macOS Command-key support for Crumble editing shortcuts, excluding paste.

Changes include:

  • Command+Z / Command+Shift+Z / Command+Y for undo and redo
  • Command+C / Command+X for copy and cut
  • Command+Enter as a Mac-friendly insert-layer shortcut
  • Command+Backspace / Command+Delete for deleting the current layer
  • Command-click as an alias for Control-click selection toggling
  • Command-click support for example links
  • Toolbox preview suppression while Command is held
  • Updated shortcut docs and button labels
  • Regenerated embedded Crumble resource

Command+V is intentionally left unchanged/out of scope because clipboard-read behavior needs separate testing across browsers.

Addresses #651.

I worked with ChatGPT to help understand the code and make edits.

Updated keyboard shortcuts to support the use of macOS command key to substitute for all instances of the control key.
mac users can use command key instead of control key. For Windows keyboard users, since the meta key is the Windows key, this means that the control key can be replaced by the Windows key. (This is a harmless side effect.)
Fixing issues with keydown when pressing cmd
@GautamNambiar
Copy link
Copy Markdown
Author

The main issue that prompted me to make this fix was that ctrl+click on mac usually leads to the equivalent of a right click in Windows. So I had found difficulty with group-selecting two sets of qubits (as a symmetric difference). The PR fixes it.

Comment thread glue/crumble/README.md Outdated
Comment thread glue/crumble/main.js
* @param {!boolean} preview
*/
function pasteTextFromClipboardEvent(text, preview) {
let pastedCircuit = Circuit.fromStimCircuit(text);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is very similar to pasteFromClipboard. This code should be written once.

@DeDuckProject
Copy link
Copy Markdown
Contributor

Description says that Cmd+V behaviour was unchanged, but the code does have it in scope.

Comment thread glue/crumble/main.js
*/
function handleKeyboardEvent(ev) {
async function handleKeyboardEvent(ev) {
if (ev.type === 'keydown' && ev.metaKey) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't these better be right next to the other chord handlers (makeChordHandlers) with meta+z etc.?

GautamNambiar and others added 2 commits May 16, 2026 12:49
Co-authored-by: Iftach Yakar <DeDuckProject@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants