Fix service access in canvas addon

This commit is contained in:
Daniel Imms
2022-07-28 11:00:08 -07:00
parent 04b513cf9b
commit 9e650cea9f
2 changed files with 10 additions and 8 deletions
+6 -4
View File
@@ -3,10 +3,10 @@
* @license MIT
*/
import { IRenderService } from 'browser/services/Services';
import { ICharSizeService, IRenderService } from 'browser/services/Services';
import { IColorSet } from 'browser/Types';
import { CanvasRenderer } from './CanvasRenderer';
import { IBufferService, IInstantiationService } from 'common/services/Services';
import { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';
import { ITerminalAddon, Terminal } from 'xterm';
export class CanvasAddon implements ITerminalAddon {
@@ -19,12 +19,14 @@ export class CanvasAddon implements ITerminalAddon {
}
this._terminal = terminal;
const instantiationService: IInstantiationService = (terminal as any)._core._instantiationService;
const bufferService: IBufferService = (terminal as any)._core._renderService;
const bufferService: IBufferService = (terminal as any)._core._bufferService;
const renderService: IRenderService = (terminal as any)._core._renderService;
const charSizeService: ICharSizeService = (terminal as any)._core._charSizeService;
const optionsService: IOptionsService = (terminal as any)._core.optionsService;
const colors: IColorSet = (terminal as any)._core._colorManager.colors;
const screenElement: HTMLElement = (terminal as any)._core.screenElement;
const linkifier = (terminal as any)._core.linkifier2;
this._renderer = instantiationService.createInstance(CanvasRenderer, colors, screenElement, linkifier);
this._renderer = new CanvasRenderer(colors, screenElement, linkifier, instantiationService, bufferService, charSizeService, optionsService);
renderService.setRenderer(this._renderer);
renderService.onResize(bufferService.cols, bufferService.rows);
}
@@ -34,10 +34,10 @@ export class CanvasRenderer extends Disposable implements IRenderer {
private _colors: IColorSet,
private readonly _screenElement: HTMLElement,
linkifier2: ILinkifier2,
@IInstantiationService instantiationService: IInstantiationService,
@IBufferService private readonly _bufferService: IBufferService,
@ICharSizeService private readonly _charSizeService: ICharSizeService,
@IOptionsService private readonly _optionsService: IOptionsService
instantiationService: IInstantiationService,
private readonly _bufferService: IBufferService,
private readonly _charSizeService: ICharSizeService,
private readonly _optionsService: IOptionsService
) {
super();
const allowTransparency = this._optionsService.rawOptions.allowTransparency;