Create BufferService

This commit is contained in:
Daniel Imms
2019-06-08 16:59:28 -07:00
parent a6540c8d06
commit 0dfc1afc21
4 changed files with 46 additions and 12 deletions
+26
View File
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IBufferService, IOptionsService } from './Services';
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
export const MINIMUM_ROWS = 1;
export class BufferService implements IBufferService {
public cols: number;
public rows: number;
constructor(
optionsService: IOptionsService
) {
this.cols = Math.max(optionsService.options.cols, MINIMUM_COLS);
this.rows = Math.max(optionsService.options.rows, MINIMUM_ROWS);
}
public resize(cols: number, rows: number): void {
this.cols = cols;
this.rows = rows;
}
}
+9
View File
@@ -5,6 +5,15 @@
import { IEvent } from 'common/EventEmitter2';
export interface IBufferService {
readonly cols: number;
readonly rows: number;
// TODO: Move resize event here
resize(cols: number, rows: number): void;
}
export interface IOptionsService {
readonly options: ITerminalOptions;