Rename altClickForMouseEvents to mouseEventsRequireAlt

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-05-27 21:41:44 +00:00
co-authored by Daniel Imms
parent 5ad56446b8
commit f8cef535c7
8 changed files with 31 additions and 31 deletions
+1 -1
View File
@@ -618,7 +618,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
this._register(addDisposableListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.handleMouseDown(e)));
// apply mouse event classes set by escape codes before terminal was attached
if (this.mouseStateService.areMouseEventsActive && !this.options.altClickForMouseEvents) {
if (this.mouseStateService.areMouseEventsActive && !this.options.mouseEventsRequireAlt) {
this._selectionService.disable();
this.element.classList.add('enable-mouse-events');
} else {
+2 -2
View File
@@ -154,7 +154,7 @@ export class MouseService implements IMouseService {
}
if (but !== CoreMouseButton.WHEEL
&& this._optionsService.rawOptions.altClickForMouseEvents
&& this._optionsService.rawOptions.mouseEventsRequireAlt
&& this._mouseStateService.areMouseEventsActive
&& !ev.altKey) {
return false;
@@ -368,7 +368,7 @@ export class MouseService implements IMouseService {
if (this._optionsService.rawOptions.logLevel === 'debug') {
this._logService.debug('Binding to mouse events:', this._explainEvents(events));
}
if (this._optionsService.rawOptions.altClickForMouseEvents) {
if (this._optionsService.rawOptions.mouseEventsRequireAlt) {
this._selectionService.enable();
} else {
element.classList.add('enable-mouse-events');
@@ -504,15 +504,15 @@ describe('SelectionService', () => {
});
describe('shouldForceSelection', () => {
it('should force selection without alt when altClickForMouseEvents is enabled', () => {
optionsService.options.altClickForMouseEvents = true;
it('should force selection without alt when mouseEventsRequireAlt is enabled', () => {
optionsService.options.mouseEventsRequireAlt = true;
mouseStateService.areMouseEventsActive = true;
assert.isTrue(selectionService.shouldForceSelection({ altKey: false } as MouseEvent));
assert.isFalse(selectionService.shouldForceSelection({ altKey: true } as MouseEvent));
});
it('should take precedence over macOptionClickForcesSelection', () => {
optionsService.options.altClickForMouseEvents = true;
optionsService.options.mouseEventsRequireAlt = true;
optionsService.options.macOptionClickForcesSelection = true;
mouseStateService.areMouseEventsActive = true;
assert.isFalse(selectionService.shouldForceSelection({ altKey: true } as MouseEvent));
+3 -3
View File
@@ -435,7 +435,7 @@ export class SelectionService extends Disposable implements ISelectionService {
* @param event The mouse event.
*/
public shouldForceSelection(event: MouseEvent): boolean {
if (this._optionsService.rawOptions.altClickForMouseEvents && this._mouseStateService.areMouseEventsActive) {
if (this._optionsService.rawOptions.mouseEventsRequireAlt && this._mouseStateService.areMouseEventsActive) {
return !event.altKey;
}
@@ -463,7 +463,7 @@ export class SelectionService extends Disposable implements ISelectionService {
return;
}
if (this._optionsService.rawOptions.altClickForMouseEvents && this._mouseStateService.areMouseEventsActive && event.altKey) {
if (this._optionsService.rawOptions.mouseEventsRequireAlt && this._mouseStateService.areMouseEventsActive && event.altKey) {
return;
}
@@ -605,7 +605,7 @@ export class SelectionService extends Disposable implements ISelectionService {
* @param event the mouse or keyboard event
*/
public shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean {
if (this._optionsService.rawOptions.altClickForMouseEvents && this._mouseStateService.areMouseEventsActive) {
if (this._optionsService.rawOptions.mouseEventsRequireAlt && this._mouseStateService.areMouseEventsActive) {
return false;
}
return event.altKey && !(Browser.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection);
+1 -1
View File
@@ -41,6 +41,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
macOptionIsMeta: false,
macOptionClickForcesSelection: false,
minimumContrastRatio: 1,
mouseEventsRequireAlt: false,
disableStdin: false,
allowProposedApi: false,
allowTransparency: false,
@@ -52,7 +53,6 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
windowOptions: {},
windowsPty: {},
wordSeparator: ' ()[]{}\',"`',
altClickForMouseEvents: false,
altClickMovesCursor: true,
convertEol: false,
termName: 'xterm',
+1 -1
View File
@@ -209,7 +209,6 @@ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';
export interface ITerminalOptions {
allowProposedApi?: boolean;
allowTransparency?: boolean;
altClickForMouseEvents?: boolean;
altClickMovesCursor?: boolean;
cols?: number;
convertEol?: boolean;
@@ -235,6 +234,7 @@ export interface ITerminalOptions {
macOptionIsMeta?: boolean;
macOptionClickForcesSelection?: boolean;
minimumContrastRatio?: number;
mouseEventsRequireAlt?: boolean;
reflowCursorLine?: boolean;
rescaleOverlappingGlyphs?: boolean;
rightClickSelectsWord?: boolean;