From e7e321fe0300103c52f9e795be6addbec437218e Mon Sep 17 00:00:00 2001 From: Dsm0 Date: Thu, 10 Jul 2025 15:03:22 -0700 Subject: [PATCH 1/2] added multicursor support on ctrl/cmd + click --- packages/codemirror/codemirror.mjs | 3 +++ website/src/repl/components/panel/SettingsTab.jsx | 6 ++++++ website/src/settings.mjs | 2 ++ 3 files changed, 11 insertions(+) diff --git a/packages/codemirror/codemirror.mjs b/packages/codemirror/codemirror.mjs index 6ba1d9c40..c4bdaca3f 100644 --- a/packages/codemirror/codemirror.mjs +++ b/packages/codemirror/codemirror.mjs @@ -38,6 +38,8 @@ const extensions = { isFlashEnabled, keybindings, isTabIndentationEnabled: (on) => (on ? keymap.of([indentWithTab]) : []), + isMultiCursorEnabled: (on) => + on ? [EditorState.allowMultipleSelections.of(true), EditorView.clickAddsSelectionRange.of((ev) => ev.metaKey || ev.ctrlKey)] : [], }; const compartments = Object.fromEntries(Object.keys(extensions).map((key) => [key, new Compartment()])); @@ -53,6 +55,7 @@ export const defaultSettings = { isTooltipEnabled: false, isLineWrappingEnabled: false, isTabIndentationEnabled: false, + isMultiCursorEnabled: false, theme: 'strudelTheme', fontFamily: 'monospace', fontSize: 18, diff --git a/website/src/repl/components/panel/SettingsTab.jsx b/website/src/repl/components/panel/SettingsTab.jsx index e82d03d87..cf2978a1a 100644 --- a/website/src/repl/components/panel/SettingsTab.jsx +++ b/website/src/repl/components/panel/SettingsTab.jsx @@ -110,6 +110,7 @@ export function SettingsTab({ started }) { maxPolyphony, multiChannelOrbits, isTabIndentationEnabled, + isMultiCursorEnabled, } = useSettings(); const shouldAlwaysSync = isUdels(); const canChangeAudioDevice = AudioContext.prototype.setSinkId != null; @@ -268,6 +269,11 @@ export function SettingsTab({ started }) { onChange={(cbEvent) => settingsMap.setKey('isTabIndentationEnabled', cbEvent.target.checked)} value={isTabIndentationEnabled} /> + settingsMap.setKey('isMultiCursorEnabled', cbEvent.target.checked)} + value={isMultiCursorEnabled} + /> settingsMap.setKey('isFlashEnabled', cbEvent.target.checked)} diff --git a/website/src/settings.mjs b/website/src/settings.mjs index 6212a6da0..3d99b656c 100644 --- a/website/src/settings.mjs +++ b/website/src/settings.mjs @@ -22,6 +22,7 @@ export const defaultSettings = { isLineWrappingEnabled: false, isPatternHighlightingEnabled: true, isTabIndentationEnabled: false, + isMultiCursorEnabled: false, theme: 'strudelTheme', fontFamily: 'monospace', fontSize: 18, @@ -79,6 +80,7 @@ export function useSettings() { isFlashEnabled: parseBoolean(state.isFlashEnabled), isSyncEnabled: isUdels() ? true : parseBoolean(state.isSyncEnabled), isTabIndentationEnabled: parseBoolean(state.isTabIndentationEnabled), + isMultiCursorEnabled: parseBoolean(state.isMultiCursorEnabled), fontSize: Number(state.fontSize), panelPosition: state.activeFooter !== '' && !isUdels() ? state.panelPosition : 'bottom', // <-- keep this 'bottom' where it is! isPanelPinned: parseBoolean(state.isPanelPinned), From eb4f1f69f6b3cbc20382444e9ddc07d2ef0d2ce0 Mon Sep 17 00:00:00 2001 From: Dsm0 Date: Thu, 10 Jul 2025 17:28:56 -0700 Subject: [PATCH 2/2] pnpm codeformat --- packages/codemirror/codemirror.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/codemirror/codemirror.mjs b/packages/codemirror/codemirror.mjs index c4bdaca3f..f47f6eba5 100644 --- a/packages/codemirror/codemirror.mjs +++ b/packages/codemirror/codemirror.mjs @@ -39,7 +39,12 @@ const extensions = { keybindings, isTabIndentationEnabled: (on) => (on ? keymap.of([indentWithTab]) : []), isMultiCursorEnabled: (on) => - on ? [EditorState.allowMultipleSelections.of(true), EditorView.clickAddsSelectionRange.of((ev) => ev.metaKey || ev.ctrlKey)] : [], + on + ? [ + EditorState.allowMultipleSelections.of(true), + EditorView.clickAddsSelectionRange.of((ev) => ev.metaKey || ev.ctrlKey), + ] + : [], }; const compartments = Object.fromEntries(Object.keys(extensions).map((key) => [key, new Compartment()]));