Merge pull request #2871 from Tyriar/layers

Support dependency injection in UnicodeService
This commit is contained in:
Daniel Imms
2020-04-25 08:44:25 -07:00
committed by GitHub
8 changed files with 14 additions and 11 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { CellData } from 'common/buffer/CellData';
import { IBufferService, IUnicodeService } from 'common/services/Services';
import { Linkifier } from 'browser/Linkifier';
import { MockLogService, MockOptionsService, MockUnicodeService } from 'common/TestUtils.test';
import { MockLogService, MockUnicodeService } from 'common/TestUtils.test';
import { IRegisteredLinkMatcher, IMouseZoneManager, IMouseZone } from 'browser/Types';
const INIT_COLS = 80;
@@ -1407,7 +1407,7 @@ describe('Terminal', () => {
class TestLinkifier extends Linkifier {
constructor(bufferService: IBufferService, unicodeService: IUnicodeService) {
super(bufferService, new MockLogService(), new MockOptionsService(), unicodeService);
super(bufferService, new MockLogService(), unicodeService);
Linkifier._timeBeforeLatency = 0;
}
+2 -2
View File
@@ -257,10 +257,10 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
}
if (!this.linkifier) {
this.linkifier = new Linkifier(this._bufferService, this._logService, this.optionsService, this.unicodeService);
this.linkifier = this._instantiationService.createInstance(Linkifier);
}
if (!this.linkifier2) {
this.linkifier2 = new Linkifier2(this._bufferService);
this.linkifier2 = this._instantiationService.createInstance(Linkifier2);
}
if (this.options.windowsMode) {
+2 -2
View File
@@ -9,13 +9,13 @@ import { IBufferLine } from 'common/Types';
import { Linkifier } from 'browser/Linkifier';
import { BufferLine } from 'common/buffer/BufferLine';
import { CellData } from 'common/buffer/CellData';
import { MockLogService, MockBufferService, MockOptionsService } from 'common/TestUtils.test';
import { MockLogService, MockBufferService } from 'common/TestUtils.test';
import { IBufferService } from 'common/services/Services';
import { UnicodeService } from 'common/services/UnicodeService';
class TestLinkifier extends Linkifier {
constructor(bufferService: IBufferService) {
super(bufferService, new MockLogService(), new MockOptionsService(), new UnicodeService());
super(bufferService, new MockLogService(), new UnicodeService());
Linkifier._timeBeforeLatency = 0;
}
+3 -4
View File
@@ -43,10 +43,9 @@ export class Linkifier implements ILinkifier {
public get onLinkTooltip(): IEvent<ILinkifierEvent> { return this._onLinkTooltip.event; }
constructor(
protected readonly _bufferService: IBufferService,
private readonly _logService: ILogService,
private readonly _optionsService: IOptionsService,
private readonly _unicodeService: IUnicodeService
@IBufferService protected readonly _bufferService: IBufferService,
@ILogService private readonly _logService: ILogService,
@IUnicodeService private readonly _unicodeService: IUnicodeService
) {
this._rowsToLinkify = {
start: undefined,
+1 -1
View File
@@ -32,7 +32,7 @@ export class Linkifier2 implements ILinkifier2 {
public get onHideLinkUnderline(): IEvent<ILinkifierEvent> { return this._onHideLinkUnderline.event; }
constructor(
private readonly _bufferService: IBufferService
@IBufferService private readonly _bufferService: IBufferService
) {
}
+1
View File
@@ -109,6 +109,7 @@ export class MockOptionsService implements IOptionsService {
// defaults to V6 always to keep tests passing
export class MockUnicodeService implements IUnicodeService {
public serviceBrand: any;
private _provider = new UnicodeV6();
public register(provider: IUnicodeVersionProvider): void {
throw new Error('Method not implemented.');
+1
View File
@@ -311,6 +311,7 @@ export interface ITheme {
export const IUnicodeService = createDecorator<IUnicodeService>('UnicodeService');
export interface IUnicodeService {
serviceBrand: any;
/** Register an Unicode version provider. */
register(provider: IUnicodeVersionProvider): void;
/** Registered Unicode versions. */
+2
View File
@@ -8,6 +8,8 @@ import { UnicodeV6 } from 'common/input/UnicodeV6';
export class UnicodeService implements IUnicodeService {
public serviceBrand: any;
private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
private _active: string = '';
private _activeProvider: IUnicodeVersionProvider;