Skip to content

Commit 41e4de3

Browse files
committed
common/public use ICoreTerminal instead of concrete
1 parent a5c6252 commit 41e4de3

File tree

7 files changed

+37
-7
lines changed

7 files changed

+37
-7
lines changed

src/browser/Types.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ export interface ITerminal extends IPublicTerminal, ICoreTerminal {
1414
element: HTMLElement | undefined;
1515
screenElement: HTMLElement | undefined;
1616
browser: IBrowser;
17-
buffer: IBuffer;
18-
buffers: IBufferSet;
1917
viewport: IViewport | undefined;
2018
// TODO: We should remove options once components adopt optionsService
2119
options: ITerminalOptions;

src/common/Types.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ import { IEvent, IEventEmitter } from 'common/EventEmitter';
88
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
99
import { IParams } from 'common/parser/Types';
1010
import { IOptionsService, IUnicodeService } from 'common/services/Services';
11+
import { IBuffer, IBufferSet } from 'common/buffer/Types';
1112

1213
export interface ICoreTerminal {
1314
optionsService: IOptionsService;
1415
unicodeService: IUnicodeService;
16+
buffers: IBufferSet;
17+
registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
18+
registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
19+
registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
20+
registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
1521
}
1622

1723
export interface IDisposable {

src/common/public/BufferApiView.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
3+
* @license MIT
4+
*/
5+
16
import { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from 'xterm';
27
import { IBuffer } from 'common/buffer/Types';
38
import { BufferLineApiView } from 'common/public/BufferLineApiView';

src/common/public/BufferLineApiView.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
3+
* @license MIT
4+
*/
5+
16
import { CellData } from 'common/buffer/CellData';
27
import { IBufferLine, ICellData } from 'common/Types';
38
import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from 'xterm';

src/common/public/BufferNamespaceApi.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
/**
2+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
3+
* @license MIT
4+
*/
5+
16
import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from 'xterm';
27
import { BufferApiView } from 'common/public/BufferApiView';
38
import { IEvent, EventEmitter } from 'common/EventEmitter';
49
import { CoreTerminal } from 'common/CoreTerminal';
10+
import { ICoreTerminal } from 'common/Types';
511

612
export class BufferNamespaceApi implements IBufferNamespaceApi {
713
private _normal: BufferApiView;
814
private _alternate: BufferApiView;
915
private _onBufferChange = new EventEmitter<IBufferApi>();
1016
public get onBufferChange(): IEvent<IBufferApi> { return this._onBufferChange.event; }
1117

12-
constructor(private _core: CoreTerminal) {
18+
constructor(private _core: ICoreTerminal) {
1319
this._normal = new BufferApiView(this._core.buffers.normal, 'normal');
1420
this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');
1521
this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));

src/common/public/ParserApi.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
/**
2+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
3+
* @license MIT
4+
*/
5+
16
import { IParams } from 'common/parser/Types';
2-
import { CoreTerminal } from 'common/CoreTerminal';
37
import { IDisposable, IFunctionIdentifier, IParser } from 'xterm';
8+
import { ICoreTerminal } from 'common/Types';
49

510
export class ParserApi implements IParser {
6-
constructor(private _core: CoreTerminal) { }
11+
constructor(private _core: ICoreTerminal) { }
712

813
public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise<boolean>): IDisposable {
914
return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));

src/common/public/UnicodeApi.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import { CoreTerminal } from 'common/CoreTerminal';
1+
/**
2+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
3+
* @license MIT
4+
*/
5+
6+
import { ICoreTerminal } from 'common/Types';
27
import { IUnicodeHandling, IUnicodeVersionProvider } from 'xterm';
38

49
export class UnicodeApi implements IUnicodeHandling {
5-
constructor(private _core: CoreTerminal) { }
10+
constructor(private _core: ICoreTerminal) { }
611

712
public register(provider: IUnicodeVersionProvider): void {
813
this._core.unicodeService.register(provider);

0 commit comments

Comments
 (0)