Add altClickForMouseEvents option for issue #5952

When enabled during mouse events mode, click/drag/move events require the alt
key while wheel events are unaffected. Selection stays enabled by default
and takes precedence over macOptionClickForcesSelection.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-05-27 20:13:31 +00:00
co-authored by Daniel Imms
parent 95d9224b8c
commit fbb2a9710f
8 changed files with 75 additions and 9 deletions
+13 -2
View File
@@ -153,6 +153,13 @@ export class MouseService implements IMouseService {
return false;
}
if (but !== CoreMouseButton.WHEEL
&& this._optionsService.rawOptions.altClickForMouseEvents
&& this._mouseStateService.areMouseEventsActive
&& !ev.altKey) {
return false;
}
return this._triggerMouseEvent({
col: pos.col,
row: pos.row,
@@ -361,8 +368,12 @@ export class MouseService implements IMouseService {
if (this._optionsService.rawOptions.logLevel === 'debug') {
this._logService.debug('Binding to mouse events:', this._explainEvents(events));
}
element.classList.add('enable-mouse-events');
this._selectionService.disable();
if (this._optionsService.rawOptions.altClickForMouseEvents) {
this._selectionService.enable();
} else {
element.classList.add('enable-mouse-events');
this._selectionService.disable();
}
} else {
this._logService.debug('Unbinding from mouse events.');
element.classList.remove('enable-mouse-events');