Move cursorState into core service

This commit is contained in:
Daniel Imms
2019-11-07 18:21:06 -08:00
parent 1e1038b2c7
commit 9d7935f8bd
9 changed files with 56 additions and 26 deletions
+4 -3
View File
@@ -9,7 +9,7 @@ import { ITerminal } from '../Types';
import { ICellData } from 'common/Types';
import { CellData } from 'common/buffer/CellData';
import { IColorSet } from 'browser/Types';
import { IBufferService, IOptionsService } from 'common/services/Services';
import { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';
import { IEventEmitter } from 'common/EventEmitter';
interface ICursorState {
@@ -39,7 +39,8 @@ export class CursorRenderLayer extends BaseRenderLayer {
rendererId: number,
private _onRequestRefreshRowsEvent: IEventEmitter<IRequestRefreshRowsEvent>,
readonly bufferService: IBufferService,
readonly optionsService: IOptionsService
readonly optionsService: IOptionsService,
private readonly _coreService: ICoreService
) {
super(container, 'cursor', zIndex, true, colors, rendererId, bufferService, optionsService);
this._state = {
@@ -127,7 +128,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
private _render(triggeredByAnimationFrame: boolean): void {
// Don't draw the cursor if it's hidden
if (!this._terminal.cursorState || this._terminal.cursorHidden) {
if (!this._coreService.isCursorInitialized || this._terminal.cursorHidden) {
this._clearCursor();
return;
}
+4 -3
View File
@@ -13,7 +13,7 @@ import { CharacterJoinerRegistry } from 'browser/renderer/CharacterJoinerRegistr
import { Disposable } from 'common/Lifecycle';
import { IColorSet } from 'browser/Types';
import { ICharSizeService } from 'browser/services/Services';
import { IBufferService, IOptionsService } from 'common/services/Services';
import { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';
import { removeTerminalFromCache } from 'browser/renderer/atlas/CharAtlasCache';
import { EventEmitter, IEvent } from 'common/EventEmitter';
@@ -36,7 +36,8 @@ export class Renderer extends Disposable implements IRenderer {
private readonly _terminal: ITerminal,
private readonly _bufferService: IBufferService,
private readonly _charSizeService: ICharSizeService,
private readonly _optionsService: IOptionsService
private readonly _optionsService: IOptionsService,
readonly coreService: ICoreService
) {
super();
const allowTransparency = this._optionsService.options.allowTransparency;
@@ -46,7 +47,7 @@ export class Renderer extends Disposable implements IRenderer {
new TextRenderLayer(this._terminal.screenElement, 0, this._colors, this._characterJoinerRegistry, allowTransparency, this._id, this._bufferService, _optionsService),
new SelectionRenderLayer(this._terminal.screenElement, 1, this._colors, this._id, this._bufferService, _optionsService),
new LinkRenderLayer(this._terminal.screenElement, 2, this._colors, this._id, this._terminal.linkifier, this._bufferService, _optionsService),
new CursorRenderLayer(this._terminal.screenElement, 3, this._colors, this._terminal, this._id, this._onRequestRefreshRows, this._bufferService, _optionsService)
new CursorRenderLayer(this._terminal.screenElement, 3, this._colors, this._terminal, this._id, this._onRequestRefreshRows, this._bufferService, _optionsService, coreService)
];
this.dimensions = {
scaledCharWidth: null,