Move buffer/buffers ownership to BufferService

This commit is contained in:
Daniel Imms
2019-06-08 20:21:29 -07:00
parent c5c370801c
commit 09b0bbed32
6 changed files with 28 additions and 8 deletions
+6 -6
View File
@@ -23,8 +23,6 @@
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminalOptions, ITerminal, IBrowser, ILinkifier, ILinkMatcherOptions, CustomKeyEventHandler, LinkMatcherHandler, IMouseZoneManager } from './Types';
import { IRenderer, CharacterJoinerHandler } from 'browser/renderer/Types';
import { BufferSet } from 'common/buffer/BufferSet';
import { Buffer } from 'common/buffer/Buffer';
import { CompositionHelper } from './CompositionHelper';
import { EventEmitter } from 'common/EventEmitter';
import { Viewport } from './Viewport';
@@ -56,6 +54,7 @@ import { OptionsService } from 'common/services/OptionsService';
import { ICharSizeService } from 'browser/services/Services';
import { CharSizeService } from 'browser/services/CharSizeService';
import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
import { IBufferSet, IBuffer } from '../out/common/buffer/Types';
// Let it work inside Node.js for automated testing purposes.
const document = (typeof window !== 'undefined') ? window.document : null;
@@ -174,7 +173,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
public soundManager: SoundManager;
public selectionManager: SelectionManager;
public linkifier: ILinkifier;
public buffers: BufferSet;
public viewport: IViewport;
private _compositionHelper: ICompositionHelper;
private _mouseZoneManager: IMouseZoneManager;
@@ -312,8 +310,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
this._mouseZoneManager = this._mouseZoneManager || null;
this.soundManager = this.soundManager || new SoundManager(this);
// Create the terminal's buffers and set the current buffer
this.buffers = new BufferSet(this.optionsService, this._bufferService);
if (this.selectionManager) {
this.selectionManager.clearSelection();
this.selectionManager.initBuffersListeners();
@@ -327,10 +323,14 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
/**
* Convenience property to active buffer.
*/
public get buffer(): Buffer {
public get buffer(): IBuffer {
return this.buffers.active;
}
public get buffers(): IBufferSet {
return this._bufferService.buffers;
}
/**
* back_color_erase feature for xterm.
*/