Remove cancelEvent/cancel function

This commit is contained in:
Daniel Imms
2026-01-31 22:18:32 -08:00
parent db131e0c22
commit bab7db13db
7 changed files with 17 additions and 31 deletions
@@ -109,7 +109,6 @@ export class OptionsWindow extends BaseWindow implements IControlWindow {
public initOptions(addDomListener: (el: HTMLElement, type: string, handler: (...args: any[]) => any) => void): void {
const blacklistedOptions = [
'cancelEvents',
'convertEol',
'termName',
'cols', 'rows',
+17 -22
View File
@@ -763,11 +763,12 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);
}
}
return this.cancel(ev);
},
wheel: (ev: WheelEvent) => {
sendEvent(ev);
return this.cancel(ev, true);
ev.preventDefault();
ev.stopPropagation();
return false;
},
mousedrag: (ev: MouseEvent) => {
// deal only with move while a button is held
@@ -867,8 +868,6 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
if (requestedEvents.mousedrag) {
this._document!.addEventListener('mousemove', requestedEvents.mousedrag);
}
return this.cancel(ev);
}));
this._register(addDisposableListener(el, 'wheel', (ev: WheelEvent) => {
@@ -899,13 +898,17 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
self._coreBrowserService?.dpr
);
if (lines === 0) {
return this.cancel(ev, true);
ev.preventDefault();
ev.stopPropagation();
return false;
}
// Construct and send sequences
const sequence = C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? 'O' : '[') + (ev.deltaY < 0 ? 'A' : 'B');
this.coreService.triggerDataEvent(sequence, true);
return this.cancel(ev, true);
ev.preventDefault();
ev.stopPropagation();
return false;
}
}, { passive: false }));
}
@@ -1115,7 +1118,9 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
if (result.type === KeyboardResultType.PAGE_DOWN || result.type === KeyboardResultType.PAGE_UP) {
const scrollCount = this.rows - 1;
this.scrollLines(result.type === KeyboardResultType.PAGE_UP ? -scrollCount : scrollCount);
return this.cancel(event, true);
event.preventDefault();
event.stopPropagation();
return false;
}
if (result.type === KeyboardResultType.SELECT_ALL) {
@@ -1128,7 +1133,8 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
if (result.cancel) {
// The event is canceled at the end already, is this necessary?
this.cancel(event, true);
event.preventDefault();
event.stopPropagation();
}
if (!result.key) {
@@ -1165,7 +1171,9 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
// is also depressed) so that the cursor textarea can be updated, which triggers the screen
// reader to read it.
if (!this.optionsService.rawOptions.screenReaderMode || event.altKey || event.ctrlKey) {
return this.cancel(event, true);
event.preventDefault();
event.stopPropagation();
return false;
}
this._keyDownHandled = true;
@@ -1225,8 +1233,6 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
return false;
}
this.cancel(ev);
if (ev.charCode) {
key = ev.charCode;
} else if (ev.which === null || ev.which === undefined) {
@@ -1279,8 +1285,6 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
const text = ev.data;
this.coreService.triggerDataEvent(text, true);
this.cancel(ev);
return true;
}
@@ -1392,15 +1396,6 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
}
}
// TODO: Remove cancel function and cancelEvents option
public cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | undefined {
if (!this.options.cancelEvents && !force) {
return;
}
ev.preventDefault();
ev.stopPropagation();
return false;
}
}
/**
-3
View File
@@ -198,9 +198,6 @@ export class MockTerminal implements ITerminal {
public scrollToRow(absoluteRow: number): number {
throw new Error('Method not implemented.');
}
public cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): void {
throw new Error('Method not implemented.');
}
public log(text: string): void {
throw new Error('Method not implemented.');
}
-2
View File
@@ -29,8 +29,6 @@ export interface ITerminal extends InternalPassthroughApis, ICoreTerminal {
onA11yChar: IEvent<string>;
onA11yTab: IEvent<number>;
onWillOpen: IEvent<HTMLElement>;
cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | void;
}
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
-1
View File
@@ -32,7 +32,6 @@ export interface IDisposable {
// TODO: The options that are not in the public API should be reviewed
export interface ITerminalOptions extends IPublicTerminalOptions {
[key: string]: any;
cancelEvents?: boolean;
convertEol?: boolean;
termName?: string;
}
-1
View File
@@ -53,7 +53,6 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
altClickMovesCursor: true,
convertEol: false,
termName: 'xterm',
cancelEvents: false,
overviewRuler: {},
quirks: {},
vtExtensions: {}
-1
View File
@@ -270,7 +270,6 @@ export interface ITerminalOptions {
vtExtensions?: IVtExtensions;
[key: string]: any;
cancelEvents: boolean;
termName: string;
}