2 * Copyright (c) 2019 The xterm.js authors. All rights reserved.
6 import { IBufferService, IOptionsService } from 'common/services/Services';
7 import { BufferSet } from 'common/buffer/BufferSet';
8 import { IBufferSet, IBuffer } from 'common/buffer/Types';
10 export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
11 export const MINIMUM_ROWS = 1;
13 export class BufferService implements IBufferService {
18 public buffers: IBufferSet;
20 public get buffer(): IBuffer { return this.buffers.active; }
23 @IOptionsService private _optionsService: IOptionsService
25 this.cols = Math.max(_optionsService.options.cols, MINIMUM_COLS);
26 this.rows = Math.max(_optionsService.options.rows, MINIMUM_ROWS);
27 this.buffers = new BufferSet(_optionsService, this);
30 public resize(cols: number, rows: number): void {
35 public reset(): void {
36 this.buffers = new BufferSet(this._optionsService, this);