mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #3946 from Tyriar/v5_remove_add_apis
Remove add* APIs and remaining link matcher parts
This commit is contained in:
@@ -35,8 +35,7 @@ declare module 'xterm-addon-web-links' {
|
||||
*/
|
||||
export interface ILinkProviderOptions {
|
||||
/**
|
||||
* A callback that fires when the mouse hovers over a link for a period of
|
||||
* time (defined by {@link ITerminalOptions.linkTooltipHoverDuration}).
|
||||
* A callback that fires when the mouse hovers over a link.
|
||||
*/
|
||||
hover?(event: MouseEvent, text: string, location: IViewportRange): void;
|
||||
|
||||
|
||||
+9
-9
@@ -736,7 +736,7 @@ function powerlineSymbolTest() {
|
||||
|
||||
function addDecoration() {
|
||||
term.options['overviewRulerWidth'] = 15;
|
||||
const marker = term.addMarker(1);
|
||||
const marker = term.registerMarker(1);
|
||||
const decoration = term.registerDecoration({
|
||||
marker,
|
||||
backgroundColor: '#00FF00',
|
||||
@@ -751,13 +751,13 @@ function addDecoration() {
|
||||
|
||||
function addOverviewRuler() {
|
||||
term.options['overviewRulerWidth'] = 15;
|
||||
term.registerDecoration({marker: term.addMarker(1), overviewRulerOptions: { color: '#ef2929' }});
|
||||
term.registerDecoration({marker: term.addMarker(3), overviewRulerOptions: { color: '#8ae234' }});
|
||||
term.registerDecoration({marker: term.addMarker(5), overviewRulerOptions: { color: '#729fcf' }});
|
||||
term.registerDecoration({marker: term.addMarker(7), overviewRulerOptions: { color: '#ef2929', position: 'left' }});
|
||||
term.registerDecoration({marker: term.addMarker(7), overviewRulerOptions: { color: '#8ae234', position: 'center' }});
|
||||
term.registerDecoration({marker: term.addMarker(7), overviewRulerOptions: { color: '#729fcf', position: 'right' }});
|
||||
term.registerDecoration({marker: term.addMarker(10), overviewRulerOptions: { color: '#8ae234', position: 'center' }});
|
||||
term.registerDecoration({marker: term.addMarker(10), overviewRulerOptions: { color: '#ffffff80', position: 'full' }});
|
||||
term.registerDecoration({marker: term.registerMarker(1), overviewRulerOptions: { color: '#ef2929' }});
|
||||
term.registerDecoration({marker: term.registerMarker(3), overviewRulerOptions: { color: '#8ae234' }});
|
||||
term.registerDecoration({marker: term.registerMarker(5), overviewRulerOptions: { color: '#729fcf' }});
|
||||
term.registerDecoration({marker: term.registerMarker(7), overviewRulerOptions: { color: '#ef2929', position: 'left' }});
|
||||
term.registerDecoration({marker: term.registerMarker(7), overviewRulerOptions: { color: '#8ae234', position: 'center' }});
|
||||
term.registerDecoration({marker: term.registerMarker(7), overviewRulerOptions: { color: '#729fcf', position: 'right' }});
|
||||
term.registerDecoration({marker: term.registerMarker(10), overviewRulerOptions: { color: '#8ae234', position: 'center' }});
|
||||
term.registerDecoration({marker: term.registerMarker(10), overviewRulerOptions: { color: '#ffffff80', position: 'full' }});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,236 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { addDisposableDomListener } from 'browser/Lifecycle';
|
||||
import { IMouseService, ISelectionService } from 'browser/services/Services';
|
||||
import { IMouseZoneManager, IMouseZone } from 'browser/Types';
|
||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
|
||||
/**
|
||||
* The MouseZoneManager allows components to register zones within the terminal
|
||||
* that trigger hover and click callbacks.
|
||||
*
|
||||
* This class was intentionally made not so robust initially as the only case it
|
||||
* needed to support was single-line links which never overlap. Improvements can
|
||||
* be made in the future.
|
||||
*/
|
||||
export class MouseZoneManager extends Disposable implements IMouseZoneManager {
|
||||
private _zones: IMouseZone[] = [];
|
||||
|
||||
private _areZonesActive: boolean = false;
|
||||
private _mouseMoveListener: (e: MouseEvent) => any;
|
||||
private _mouseLeaveListener: (e: MouseEvent) => any;
|
||||
private _clickListener: (e: MouseEvent) => any;
|
||||
|
||||
private _tooltipTimeout: number | undefined;
|
||||
private _currentZone: IMouseZone | undefined;
|
||||
private _lastHoverCoords: [number | undefined, number | undefined] = [undefined, undefined];
|
||||
private _initialSelectionLength: number = 0;
|
||||
|
||||
constructor(
|
||||
private readonly _element: HTMLElement,
|
||||
private readonly _screenElement: HTMLElement,
|
||||
@IBufferService private readonly _bufferService: IBufferService,
|
||||
@IMouseService private readonly _mouseService: IMouseService,
|
||||
@ISelectionService private readonly _selectionService: ISelectionService,
|
||||
@IOptionsService private readonly _optionsService: IOptionsService
|
||||
) {
|
||||
super();
|
||||
|
||||
this.register(addDisposableDomListener(this._element, 'mousedown', e => this._onMouseDown(e)));
|
||||
|
||||
// These events are expensive, only listen to it when mouse zones are active
|
||||
this._mouseMoveListener = e => this._onMouseMove(e);
|
||||
this._mouseLeaveListener = e => this._onMouseLeave(e);
|
||||
this._clickListener = e => this._onClick(e);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
super.dispose();
|
||||
this._deactivate();
|
||||
}
|
||||
|
||||
public add(zone: IMouseZone): void {
|
||||
this._zones.push(zone);
|
||||
if (this._zones.length === 1) {
|
||||
this._activate();
|
||||
}
|
||||
}
|
||||
|
||||
public clearAll(start?: number, end?: number): void {
|
||||
// Exit if there's nothing to clear
|
||||
if (this._zones.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear all if start/end weren't set
|
||||
if (!start || !end) {
|
||||
start = 0;
|
||||
end = this._bufferService.rows - 1;
|
||||
}
|
||||
|
||||
// Iterate through zones and clear them out if they're within the range
|
||||
for (let i = 0; i < this._zones.length; i++) {
|
||||
const zone = this._zones[i];
|
||||
if ((zone.y1 > start && zone.y1 <= end + 1) ||
|
||||
(zone.y2 > start && zone.y2 <= end + 1) ||
|
||||
(zone.y1 < start && zone.y2 > end + 1)) {
|
||||
if (this._currentZone && this._currentZone === zone) {
|
||||
this._currentZone.leaveCallback();
|
||||
this._currentZone = undefined;
|
||||
}
|
||||
this._zones.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Deactivate the mouse zone manager if all the zones have been removed
|
||||
if (this._zones.length === 0) {
|
||||
this._deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
private _activate(): void {
|
||||
if (!this._areZonesActive) {
|
||||
this._areZonesActive = true;
|
||||
this._element.addEventListener('mousemove', this._mouseMoveListener);
|
||||
this._element.addEventListener('mouseleave', this._mouseLeaveListener);
|
||||
this._element.addEventListener('click', this._clickListener);
|
||||
}
|
||||
}
|
||||
|
||||
private _deactivate(): void {
|
||||
if (this._areZonesActive) {
|
||||
this._areZonesActive = false;
|
||||
this._element.removeEventListener('mousemove', this._mouseMoveListener);
|
||||
this._element.removeEventListener('mouseleave', this._mouseLeaveListener);
|
||||
this._element.removeEventListener('click', this._clickListener);
|
||||
}
|
||||
}
|
||||
|
||||
private _onMouseMove(e: MouseEvent): void {
|
||||
// TODO: Ideally this would only clear the hover state when the mouse moves
|
||||
// outside of the mouse zone
|
||||
if (this._lastHoverCoords[0] !== e.pageX || this._lastHoverCoords[1] !== e.pageY) {
|
||||
this._onHover(e);
|
||||
// Record the current coordinates
|
||||
this._lastHoverCoords = [e.pageX, e.pageY];
|
||||
}
|
||||
}
|
||||
|
||||
private _onHover(e: MouseEvent): void {
|
||||
const zone = this._findZoneEventAt(e);
|
||||
|
||||
// Do nothing if the zone is the same
|
||||
if (zone === this._currentZone) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fire the hover end callback and cancel any existing timer if a new zone
|
||||
// is being hovered
|
||||
if (this._currentZone) {
|
||||
this._currentZone.leaveCallback();
|
||||
this._currentZone = undefined;
|
||||
if (this._tooltipTimeout) {
|
||||
clearTimeout(this._tooltipTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
// Exit if there is not zone
|
||||
if (!zone) {
|
||||
return;
|
||||
}
|
||||
this._currentZone = zone;
|
||||
|
||||
// Trigger the hover callback
|
||||
if (zone.hoverCallback) {
|
||||
zone.hoverCallback(e);
|
||||
}
|
||||
|
||||
// Restart the tooltip timeout
|
||||
this._tooltipTimeout = window.setTimeout(() => this._onTooltip(e), this._optionsService.rawOptions.linkTooltipHoverDuration);
|
||||
}
|
||||
|
||||
private _onTooltip(e: MouseEvent): void {
|
||||
this._tooltipTimeout = undefined;
|
||||
const zone = this._findZoneEventAt(e);
|
||||
zone?.tooltipCallback(e);
|
||||
}
|
||||
|
||||
private _onMouseDown(e: MouseEvent): void {
|
||||
// Store current terminal selection length, to check if we're performing
|
||||
// a selection operation
|
||||
this._initialSelectionLength = this._getSelectionLength();
|
||||
|
||||
// Ignore the event if there are no zones active
|
||||
if (!this._areZonesActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the active zone, prevent event propagation if found to prevent other
|
||||
// components from handling the mouse event.
|
||||
const zone = this._findZoneEventAt(e);
|
||||
if (zone?.willLinkActivate(e)) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
|
||||
private _onMouseLeave(e: MouseEvent): void {
|
||||
// Fire the hover end callback and cancel any existing timer if the mouse
|
||||
// leaves the terminal element
|
||||
if (this._currentZone) {
|
||||
this._currentZone.leaveCallback();
|
||||
this._currentZone = undefined;
|
||||
if (this._tooltipTimeout) {
|
||||
clearTimeout(this._tooltipTimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _onClick(e: MouseEvent): void {
|
||||
// Find the active zone and click it if found and no selection was
|
||||
// being performed
|
||||
const zone = this._findZoneEventAt(e);
|
||||
const currentSelectionLength = this._getSelectionLength();
|
||||
|
||||
if (zone && currentSelectionLength === this._initialSelectionLength) {
|
||||
zone.clickCallback(e);
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
|
||||
private _getSelectionLength(): number {
|
||||
const selectionText = this._selectionService.selectionText;
|
||||
return selectionText ? selectionText.length : 0;
|
||||
}
|
||||
|
||||
private _findZoneEventAt(e: MouseEvent): IMouseZone | undefined {
|
||||
const coords = this._mouseService.getCoords(e, this._screenElement, this._bufferService.cols, this._bufferService.rows);
|
||||
if (!coords) {
|
||||
return undefined;
|
||||
}
|
||||
const x = coords[0];
|
||||
const y = coords[1];
|
||||
for (let i = 0; i < this._zones.length; i++) {
|
||||
const zone = this._zones[i];
|
||||
if (zone.y1 === zone.y2) {
|
||||
// Single line link
|
||||
if (y === zone.y1 && x >= zone.x1 && x < zone.x2) {
|
||||
return zone;
|
||||
}
|
||||
} else {
|
||||
// Multi-line link
|
||||
if ((y === zone.y1 && x >= zone.x1) ||
|
||||
(y === zone.y2 && x < zone.x2) ||
|
||||
(y > zone.y1 && y < zone.y2)) {
|
||||
return zone;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import { MockViewport, MockCompositionHelper, MockRenderer, TestTerminal } from
|
||||
import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
|
||||
import { CellData } from 'common/buffer/CellData';
|
||||
import { MockUnicodeService } from 'common/TestUtils.test';
|
||||
import { IMouseZoneManager, IMouseZone } from 'browser/Types';
|
||||
import { IMarker } from 'common/Types';
|
||||
|
||||
const INIT_COLS = 80;
|
||||
@@ -1417,16 +1416,3 @@ describe('Terminal', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
class TestMouseZoneManager implements IMouseZoneManager {
|
||||
public dispose(): void {
|
||||
}
|
||||
public clears: number = 0;
|
||||
public zones: IMouseZone[] = [];
|
||||
public add(zone: IMouseZone): void {
|
||||
this.zones.push(zone);
|
||||
}
|
||||
public clearAll(): void {
|
||||
this.clears++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* http://linux.die.net/man/7/urxvt
|
||||
*/
|
||||
|
||||
import { ICompositionHelper, ITerminal, IBrowser, CustomKeyEventHandler, IMouseZoneManager, IViewport, ILinkifier2, CharacterJoinerHandler } from 'browser/Types';
|
||||
import { ICompositionHelper, ITerminal, IBrowser, CustomKeyEventHandler, IViewport, ILinkifier2, CharacterJoinerHandler } from 'browser/Types';
|
||||
import { IRenderer } from 'browser/renderer/Types';
|
||||
import { CompositionHelper } from 'browser/input/CompositionHelper';
|
||||
import { Viewport } from 'browser/Viewport';
|
||||
@@ -33,7 +33,6 @@ import { SelectionService } from 'browser/services/SelectionService';
|
||||
import * as Browser from 'common/Platform';
|
||||
import { addDisposableDomListener } from 'browser/Lifecycle';
|
||||
import * as Strings from 'browser/LocalizableStrings';
|
||||
import { MouseZoneManager } from 'browser/MouseZoneManager';
|
||||
import { AccessibilityManager } from './AccessibilityManager';
|
||||
import { ITheme, IMarker, IDisposable, ISelectionPosition, ILinkProvider, IDecorationOptions, IDecoration } from 'xterm';
|
||||
import { DomRenderer } from 'browser/renderer/dom/DomRenderer';
|
||||
@@ -118,7 +117,6 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
public linkifier2: ILinkifier2;
|
||||
public viewport: IViewport | undefined;
|
||||
private _compositionHelper: ICompositionHelper | undefined;
|
||||
private _mouseZoneManager: IMouseZoneManager | undefined;
|
||||
private _accessibilityManager: AccessibilityManager | undefined;
|
||||
private _colorManager: ColorManager | undefined;
|
||||
private _theme: ITheme | undefined;
|
||||
@@ -576,12 +574,8 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
}));
|
||||
this.register(addDisposableDomListener(this._viewportElement, 'scroll', () => this._selectionService!.refresh()));
|
||||
|
||||
this._mouseZoneManager = this._instantiationService.createInstance(MouseZoneManager, this.element, this.screenElement);
|
||||
this.register(this._mouseZoneManager);
|
||||
this.register(this.onScroll(() => this._mouseZoneManager!.clearAll()));
|
||||
this.linkifier2.attachToDom(this.screenElement, this._mouseService, this._renderService);
|
||||
this.register(this._instantiationService.createInstance(BufferDecorationRenderer, this.screenElement));
|
||||
// This event listener must be registered aftre MouseZoneManager is created
|
||||
this.register(addDisposableDomListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.onMouseDown(e)));
|
||||
|
||||
// apply mouse event classes set by escape codes before terminal was attached
|
||||
|
||||
Vendored
-17
@@ -177,23 +177,6 @@ export interface ILinkifier2 {
|
||||
registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
|
||||
}
|
||||
|
||||
export interface IMouseZoneManager extends IDisposable {
|
||||
add(zone: IMouseZone): void;
|
||||
clearAll(start?: number, end?: number): void;
|
||||
}
|
||||
|
||||
export interface IMouseZone {
|
||||
x1: number;
|
||||
x2: number;
|
||||
y1: number;
|
||||
y2: number;
|
||||
clickCallback: (e: MouseEvent) => any;
|
||||
hoverCallback: (e: MouseEvent) => any | undefined;
|
||||
tooltipCallback: (e: MouseEvent) => any | undefined;
|
||||
leaveCallback: () => any | undefined;
|
||||
willLinkActivate: (e: MouseEvent) => boolean;
|
||||
}
|
||||
|
||||
interface ILinkProvider {
|
||||
provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,6 @@ export class Terminal implements ITerminalApi {
|
||||
this._core.deregisterCharacterJoiner(joinerId);
|
||||
}
|
||||
public registerMarker(cursorYOffset: number = 0): IMarker | undefined {
|
||||
this._checkProposedApi();
|
||||
this._verifyIntegers(cursorYOffset);
|
||||
return this._core.addMarker(cursorYOffset);
|
||||
}
|
||||
@@ -169,9 +168,6 @@ export class Terminal implements ITerminalApi {
|
||||
this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0);
|
||||
return this._core.registerDecoration(decorationOptions);
|
||||
}
|
||||
public addMarker(cursorYOffset: number): IMarker | undefined {
|
||||
return this.registerMarker(cursorYOffset);
|
||||
}
|
||||
public hasSelection(): boolean {
|
||||
return this._core.hasSelection();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ export const DEFAULT_OPTIONS: Readonly<ITerminalOptions> = {
|
||||
fontWeight: 'normal',
|
||||
fontWeightBold: 'bold',
|
||||
lineHeight: 1.0,
|
||||
linkTooltipHoverDuration: 500,
|
||||
letterSpacing: 0,
|
||||
logLevel: 'info',
|
||||
scrollback: 1000,
|
||||
|
||||
@@ -228,7 +228,6 @@ export interface ITerminalOptions {
|
||||
fontWeightBold: FontWeight;
|
||||
letterSpacing: number;
|
||||
lineHeight: number;
|
||||
linkTooltipHoverDuration: number;
|
||||
logLevel: LogLevel;
|
||||
macOptionIsMeta: boolean;
|
||||
macOptionClickForcesSelection: boolean;
|
||||
|
||||
+12
-12
@@ -569,11 +569,11 @@ describe('API Integration Tests', function(): void {
|
||||
await writeSync(page, '\\n\\n\\n\\n');
|
||||
await writeSync(page, '\\n\\n\\n\\n');
|
||||
await writeSync(page, '\\n\\n\\n\\n');
|
||||
await page.evaluate(`window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.term.addMarker(2)`);
|
||||
await page.evaluate(`window.term.registerMarker(1)`);
|
||||
await page.evaluate(`window.term.registerMarker(2)`);
|
||||
await page.evaluate(`window.term.scrollLines(10)`);
|
||||
await page.evaluate(`window.term.addMarker(3)`);
|
||||
await page.evaluate(`window.term.addMarker(4)`);
|
||||
await page.evaluate(`window.term.registerMarker(3)`);
|
||||
await page.evaluate(`window.term.registerMarker(4)`);
|
||||
await page.evaluate(`
|
||||
for (let i = 0; i < window.term.markers.length; ++i) {
|
||||
const marker = window.term.markers[i];
|
||||
@@ -737,8 +737,8 @@ describe('API Integration Tests', function(): void {
|
||||
await page.evaluate(`window.term = new Terminal({ allowProposedApi: true })`);
|
||||
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
|
||||
await page.waitForSelector('.xterm-text-layer');
|
||||
await page.evaluate(`window.marker1 = window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.marker2 = window.term.addMarker(2)`);
|
||||
await page.evaluate(`window.marker1 = window.term.registerMarker(1)`);
|
||||
await page.evaluate(`window.marker2 = window.term.registerMarker(2)`);
|
||||
await page.evaluate(`window.term.registerDecoration({ marker: window.marker1 })`);
|
||||
await page.evaluate(`window.term.registerDecoration({ marker: window.marker2 })`);
|
||||
await openTerminal(page);
|
||||
@@ -746,13 +746,13 @@ describe('API Integration Tests', function(): void {
|
||||
});
|
||||
it('should return undefined when the marker has already been disposed of', async () => {
|
||||
await openTerminal(page);
|
||||
await page.evaluate(`window.marker = window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.marker = window.term.registerMarker(1)`);
|
||||
await page.evaluate(`window.marker.dispose()`);
|
||||
await pollFor(page, `window.decoration = window.term.registerDecoration({ marker: window.marker });`, undefined);
|
||||
});
|
||||
it('should throw when a negative x offset is provided', async () => {
|
||||
await openTerminal(page);
|
||||
await page.evaluate(`window.marker = window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.marker = window.term.registerMarker(1)`);
|
||||
await page.evaluate(`
|
||||
try {
|
||||
window.decoration = window.term.registerDecoration({ marker: window.marker, x: -2 });
|
||||
@@ -768,8 +768,8 @@ describe('API Integration Tests', function(): void {
|
||||
await page.evaluate(`window.term = new Terminal({ allowProposedApi: true })`);
|
||||
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
|
||||
await page.waitForSelector('.xterm-text-layer');
|
||||
await page.evaluate(`window.marker1 = window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.marker2 = window.term.addMarker(2)`);
|
||||
await page.evaluate(`window.marker1 = window.term.registerMarker(1)`);
|
||||
await page.evaluate(`window.marker2 = window.term.registerMarker(2)`);
|
||||
await page.evaluate(`window.term.registerDecoration({ marker: window.marker1, overviewRulerOptions: { color: 'red', position: 'full' } })`);
|
||||
await page.evaluate(`window.term.registerDecoration({ marker: window.marker2, overviewRulerOptions: { color: 'blue', position: 'full' } })`);
|
||||
await openTerminal(page);
|
||||
@@ -779,8 +779,8 @@ describe('API Integration Tests', function(): void {
|
||||
await page.evaluate(`window.term = new Terminal({ allowProposedApi: true, overviewRulerWidth: 15 })`);
|
||||
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
|
||||
await page.waitForSelector('.xterm-text-layer');
|
||||
await page.evaluate(`window.marker1 = window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.marker2 = window.term.addMarker(2)`);
|
||||
await page.evaluate(`window.marker1 = window.term.registerMarker(1)`);
|
||||
await page.evaluate(`window.marker2 = window.term.registerMarker(2)`);
|
||||
await page.evaluate(`window.term.registerDecoration({ marker: window.marker1, overviewRulerOptions: { color: 'red', position: 'full' } })`);
|
||||
await page.evaluate(`window.term.registerDecoration({ marker: window.marker2, overviewRulerOptions: { color: 'blue', position: 'full' } })`);
|
||||
await openTerminal(page);
|
||||
|
||||
Vendored
+2
-14
@@ -101,13 +101,6 @@ declare module 'xterm-headless' {
|
||||
*/
|
||||
lineHeight?: number;
|
||||
|
||||
/**
|
||||
* The duration in milliseconds before link tooltip events fire when
|
||||
* hovering on a link.
|
||||
* @deprecated This will be removed when the link matcher API is removed.
|
||||
*/
|
||||
linkTooltipHoverDuration?: number;
|
||||
|
||||
/**
|
||||
* What log level to use, this will log for all levels below and including
|
||||
* what is set:
|
||||
@@ -630,18 +623,13 @@ declare module 'xterm-headless' {
|
||||
resize(columns: number, rows: number): void;
|
||||
|
||||
/**
|
||||
* (EXPERIMENTAL) Adds a marker to the normal buffer and returns it. If the
|
||||
* alt buffer is active, undefined is returned.
|
||||
* Adds a marker to the normal buffer and returns it. If the alt buffer is
|
||||
* active, undefined is returned.
|
||||
* @param cursorYOffset The y position offset of the marker from the cursor.
|
||||
* @returns The new marker or undefined.
|
||||
*/
|
||||
registerMarker(cursorYOffset?: number): IMarker | undefined;
|
||||
|
||||
/**
|
||||
* @deprecated use `registerMarker` instead.
|
||||
*/
|
||||
addMarker(cursorYOffset: number): IMarker | undefined;
|
||||
|
||||
/*
|
||||
* Disposes of the terminal, detaching it from the DOM and removing any
|
||||
* active listeners.
|
||||
|
||||
Vendored
+2
-14
@@ -138,13 +138,6 @@ declare module 'xterm' {
|
||||
*/
|
||||
lineHeight?: number;
|
||||
|
||||
/**
|
||||
* The duration in milliseconds before link tooltip events fire when
|
||||
* hovering on a link.
|
||||
* @deprecated This will be removed when the link matcher API is removed.
|
||||
*/
|
||||
linkTooltipHoverDuration?: number;
|
||||
|
||||
/**
|
||||
* What log level to use, this will log for all levels below and including
|
||||
* what is set:
|
||||
@@ -912,18 +905,13 @@ declare module 'xterm' {
|
||||
deregisterCharacterJoiner(joinerId: number): void;
|
||||
|
||||
/**
|
||||
* (EXPERIMENTAL) Adds a marker to the normal buffer and returns it. If the
|
||||
* alt buffer is active, undefined is returned.
|
||||
* Adds a marker to the normal buffer and returns it. If the alt buffer is
|
||||
* active, undefined is returned.
|
||||
* @param cursorYOffset The y position offset of the marker from the cursor.
|
||||
* @returns The new marker or undefined.
|
||||
*/
|
||||
registerMarker(cursorYOffset?: number): IMarker | undefined;
|
||||
|
||||
/**
|
||||
* @deprecated use `registerMarker` instead.
|
||||
*/
|
||||
addMarker(cursorYOffset: number): IMarker | undefined;
|
||||
|
||||
/**
|
||||
* (EXPERIMENTAL) Adds a decoration to the terminal using
|
||||
* @param decorationOptions, which takes a marker and an optional anchor,
|
||||
|
||||
Reference in New Issue
Block a user