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;
+10 -10
View File
@@ -38,16 +38,6 @@ declare module '@xterm/headless' {
*/
altClickMovesCursor?: boolean;
/**
* When enabled and the terminal is in mouse events mode, mouse click, drag,
* and move events are only sent to the underlying application when the alt
* key is held. Wheel events are not affected. This allows normal text
* selection by default while still supporting application mouse interaction
* and scrolling when holding alt. When enabled, this takes precedence over
* `macOptionClickForcesSelection`.
*/
altClickForMouseEvents?: boolean;
/**
* When enabled the cursor will be set to the beginning of the next line
* with every new line. This is equivalent to sending '\r\n' for each '\n'.
@@ -146,6 +136,16 @@ declare module '@xterm/headless' {
*/
minimumContrastRatio?: number;
/**
* When enabled and the terminal is in mouse events mode, mouse click, drag,
* and move events are only sent to the underlying application when the alt
* key is held. Wheel events are not affected. This allows normal text
* selection by default while still supporting application mouse interaction
* and scrolling when holding alt. When enabled, this takes precedence over
* `macOptionClickForcesSelection`.
*/
mouseEventsRequireAlt?: boolean;
/**
* Whether to reflow the line containing the cursor when the terminal is
* resized. Defaults to false, because shells usually handle this
+10 -10
View File
@@ -45,16 +45,6 @@ declare module '@xterm/xterm' {
*/
altClickMovesCursor?: boolean;
/**
* When enabled and the terminal is in mouse events mode, mouse click, drag,
* and move events are only sent to the underlying application when the alt
* key is held. Wheel events are not affected. This allows normal text
* selection by default while still supporting application mouse interaction
* and scrolling when holding alt. When enabled, this takes precedence over
* `macOptionClickForcesSelection`.
*/
altClickForMouseEvents?: boolean;
/**
* When enabled the cursor will be set to the beginning of the next line
* with every new line. This is equivalent to sending `\r\n` for each `\n`.
@@ -216,6 +206,16 @@ declare module '@xterm/xterm' {
*/
minimumContrastRatio?: number;
/**
* When enabled and the terminal is in mouse events mode, mouse click, drag,
* and move events are only sent to the underlying application when the alt
* key is held. Wheel events are not affected. This allows normal text
* selection by default while still supporting application mouse interaction
* and scrolling when holding alt. When enabled, this takes precedence over
* `macOptionClickForcesSelection`.
*/
mouseEventsRequireAlt?: boolean;
/**
* Control various quirks features that are either non-standard or standard
* in but generally rejected in modern terminals.