Merge branch 'master' into remove_ee
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { IBufferService, IOptionsService } from './Services';
|
||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
import { BufferSet } from 'common/buffer/BufferSet';
|
||||
import { IBufferSet, IBuffer } from 'common/buffer/Types';
|
||||
|
||||
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
||||
export const MINIMUM_ROWS = 1;
|
||||
@@ -11,16 +13,24 @@ export const MINIMUM_ROWS = 1;
|
||||
export class BufferService implements IBufferService {
|
||||
public cols: number;
|
||||
public rows: number;
|
||||
public buffers: IBufferSet;
|
||||
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
|
||||
constructor(
|
||||
optionsService: IOptionsService
|
||||
private _optionsService: IOptionsService
|
||||
) {
|
||||
this.cols = Math.max(optionsService.options.cols, MINIMUM_COLS);
|
||||
this.rows = Math.max(optionsService.options.rows, MINIMUM_ROWS);
|
||||
this.cols = Math.max(_optionsService.options.cols, MINIMUM_COLS);
|
||||
this.rows = Math.max(_optionsService.options.rows, MINIMUM_ROWS);
|
||||
this.buffers = new BufferSet(_optionsService, this);
|
||||
}
|
||||
|
||||
public resize(cols: number, rows: number): void {
|
||||
this.cols = cols;
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
this.buffers = new BufferSet(this._optionsService, this);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -4,14 +4,18 @@
|
||||
*/
|
||||
|
||||
import { IEvent } from 'common/EventEmitter';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
|
||||
export interface IBufferService {
|
||||
readonly cols: number;
|
||||
readonly rows: number;
|
||||
readonly buffer: IBuffer;
|
||||
readonly buffers: IBufferSet;
|
||||
|
||||
// TODO: Move resize event here
|
||||
|
||||
resize(cols: number, rows: number): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
export interface IOptionsService {
|
||||
|
||||
Reference in New Issue
Block a user