Introduce ICoreTerminal
This commit is contained in:
@@ -3,18 +3,18 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ILinkifierAccessor } from '../../../../src/Types';
|
|
||||||
import { Terminal } from 'xterm';
|
import { Terminal } from 'xterm';
|
||||||
import { BaseRenderLayer } from './BaseRenderLayer';
|
import { BaseRenderLayer } from './BaseRenderLayer';
|
||||||
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';
|
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';
|
||||||
import { is256Color } from '../atlas/CharAtlasUtils';
|
import { is256Color } from '../atlas/CharAtlasUtils';
|
||||||
import { IColorSet, ILinkifierEvent } from 'browser/Types';
|
import { IColorSet, ILinkifierEvent, ILinkifier, ILinkifier2 } from 'browser/Types';
|
||||||
import { IRenderDimensions } from 'browser/renderer/Types';
|
import { IRenderDimensions } from 'browser/renderer/Types';
|
||||||
|
import { ITerminal } from '../../../../src/Types';
|
||||||
|
|
||||||
export class LinkRenderLayer extends BaseRenderLayer {
|
export class LinkRenderLayer extends BaseRenderLayer {
|
||||||
private _state: ILinkifierEvent | undefined;
|
private _state: ILinkifierEvent | undefined;
|
||||||
|
|
||||||
constructor(container: HTMLElement, zIndex: number, colors: IColorSet, terminal: ILinkifierAccessor) {
|
constructor(container: HTMLElement, zIndex: number, colors: IColorSet, terminal: ITerminal) {
|
||||||
super(container, 'link', zIndex, true, colors);
|
super(container, 'link', zIndex, true, colors);
|
||||||
terminal.linkifier.onShowLinkUnderline(e => this._onShowLinkUnderline(e));
|
terminal.linkifier.onShowLinkUnderline(e => this._onShowLinkUnderline(e));
|
||||||
terminal.linkifier.onHideLinkUnderline(e => this._onHideLinkUnderline(e));
|
terminal.linkifier.onHideLinkUnderline(e => this._onHideLinkUnderline(e));
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ export class MockTerminal implements ITerminal {
|
|||||||
public addDisposableListener(type: string, handler: XtermListener): IDisposable {
|
public addDisposableListener(type: string, handler: XtermListener): IDisposable {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
public scrollLines(disp: number, suppressScrollEvent: boolean): void {
|
public scrollLines(disp: number): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
public scrollToRow(absoluteRow: number): number {
|
public scrollToRow(absoluteRow: number): number {
|
||||||
|
|||||||
Vendored
+7
-18
@@ -4,12 +4,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable, IMarker, ISelectionPosition, ILinkProvider } from 'xterm';
|
import { IDisposable, IMarker, ISelectionPosition, ILinkProvider } from 'xterm';
|
||||||
import { IAttributeData, CharData, ITerminalOptions } from 'common/Types';
|
import { IAttributeData, CharData, ITerminalOptions, ICoreTerminal } from 'common/Types';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
import { IEvent } from 'common/EventEmitter';
|
||||||
import { ILinkifier, ILinkMatcherOptions, IViewport, ILinkifier2 } from 'browser/Types';
|
import { ILinkifier, ILinkMatcherOptions, IViewport, ILinkifier2 } from 'browser/Types';
|
||||||
import { IOptionsService, IUnicodeService } from 'common/services/Services';
|
import { IOptionsService, IUnicodeService } from 'common/services/Services';
|
||||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||||
import { IParams, IFunctionIdentifier } from 'common/parser/Types';
|
import { IParams, IFunctionIdentifier } from 'common/parser/Types';
|
||||||
|
import { Linkifier } from 'browser/Linkifier';
|
||||||
|
import { Linkifier2 } from 'browser/Linkifier2';
|
||||||
|
|
||||||
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
||||||
|
|
||||||
@@ -23,23 +25,23 @@ export interface ICompositionHelper {
|
|||||||
keydown(ev: KeyboardEvent): boolean;
|
keydown(ev: KeyboardEvent): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITerminal extends IPublicTerminal, IElementAccessor, IBufferAccessor, ILinkifierAccessor {
|
export interface ITerminal extends IPublicTerminal, ICoreTerminal {
|
||||||
|
element: HTMLElement | undefined;
|
||||||
screenElement: HTMLElement;
|
screenElement: HTMLElement;
|
||||||
browser: IBrowser;
|
browser: IBrowser;
|
||||||
buffer: IBuffer;
|
buffer: IBuffer;
|
||||||
buffers: IBufferSet;
|
buffers: IBufferSet;
|
||||||
viewport: IViewport;
|
viewport: IViewport;
|
||||||
optionsService: IOptionsService;
|
|
||||||
// TODO: We should remove options once components adopt optionsService
|
// TODO: We should remove options once components adopt optionsService
|
||||||
options: ITerminalOptions;
|
options: ITerminalOptions;
|
||||||
unicodeService: IUnicodeService;
|
linkifier: ILinkifier;
|
||||||
|
linkifier2: ILinkifier2;
|
||||||
|
|
||||||
onBlur: IEvent<void>;
|
onBlur: IEvent<void>;
|
||||||
onFocus: IEvent<void>;
|
onFocus: IEvent<void>;
|
||||||
onA11yChar: IEvent<string>;
|
onA11yChar: IEvent<string>;
|
||||||
onA11yTab: IEvent<number>;
|
onA11yTab: IEvent<number>;
|
||||||
|
|
||||||
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
|
||||||
cancel(ev: Event, force?: boolean): boolean | void;
|
cancel(ev: Event, force?: boolean): boolean | void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,19 +97,6 @@ export interface IPublicTerminal extends IDisposable {
|
|||||||
reset(): void;
|
reset(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBufferAccessor {
|
|
||||||
buffer: IBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IElementAccessor {
|
|
||||||
readonly element: HTMLElement | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ILinkifierAccessor {
|
|
||||||
linkifier: ILinkifier;
|
|
||||||
linkifier2: ILinkifier2;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IBrowser {
|
export interface IBrowser {
|
||||||
isNode: boolean;
|
isNode: boolean;
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { InstantiationService } from 'common/services/InstantiationService';
|
|||||||
import { LogService } from 'common/services/LogService';
|
import { LogService } from 'common/services/LogService';
|
||||||
import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
|
import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
|
||||||
import { OptionsService } from 'common/services/OptionsService';
|
import { OptionsService } from 'common/services/OptionsService';
|
||||||
import { ITerminalOptions, IDisposable, IBufferLine, IAttributeData } from 'common/Types';
|
import { ITerminalOptions, IDisposable, IBufferLine, IAttributeData, ICoreTerminal } from 'common/Types';
|
||||||
import { CoreService } from 'common/services/CoreService';
|
import { CoreService } from 'common/services/CoreService';
|
||||||
import { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';
|
import { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';
|
||||||
import { CoreMouseService } from 'common/services/CoreMouseService';
|
import { CoreMouseService } from 'common/services/CoreMouseService';
|
||||||
@@ -40,7 +40,7 @@ import { IBufferSet } from 'common/buffer/Types';
|
|||||||
import { InputHandler } from 'common/InputHandler';
|
import { InputHandler } from 'common/InputHandler';
|
||||||
import { WriteBuffer } from 'common/input/WriteBuffer';
|
import { WriteBuffer } from 'common/input/WriteBuffer';
|
||||||
|
|
||||||
export abstract class CoreTerminal extends Disposable {
|
export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
||||||
protected readonly _instantiationService: IInstantiationService;
|
protected readonly _instantiationService: IInstantiationService;
|
||||||
protected readonly _bufferService: IBufferService;
|
protected readonly _bufferService: IBufferService;
|
||||||
protected readonly _logService: ILogService;
|
protected readonly _logService: ILogService;
|
||||||
|
|||||||
Vendored
+6
@@ -7,6 +7,12 @@ import { ITerminalOptions as IPublicTerminalOptions } from 'xterm';
|
|||||||
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
||||||
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
|
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
|
||||||
import { IParams } from 'common/parser/Types';
|
import { IParams } from 'common/parser/Types';
|
||||||
|
import { IOptionsService, IUnicodeService } from 'common/services/Services';
|
||||||
|
|
||||||
|
export interface ICoreTerminal {
|
||||||
|
optionsService: IOptionsService;
|
||||||
|
unicodeService: IUnicodeService;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IDisposable {
|
export interface IDisposable {
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
|
|||||||
Reference in New Issue
Block a user