Rename altClickForMouseEvents to mouseEventsRequireAlt
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
co-authored by
Daniel Imms
parent
5ad56446b8
commit
f8cef535c7
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user