added multicursor support on ctrl/cmd + click

This commit is contained in:
Dsm0 2025-07-10 15:03:22 -07:00
parent 6fe11be218
commit e7e321fe03
3 changed files with 11 additions and 0 deletions

View file

@ -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,

View file

@ -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}
/>
<Checkbox
label="Enable Multi-Cursor (Cmd/Ctrl+Click)"
onChange={(cbEvent) => settingsMap.setKey('isMultiCursorEnabled', cbEvent.target.checked)}
value={isMultiCursorEnabled}
/>
<Checkbox
label="Enable flashing on evaluation"
onChange={(cbEvent) => settingsMap.setKey('isFlashEnabled', cbEvent.target.checked)}

View file

@ -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),