Merge branch 'master' into remove_ee

This commit is contained in:
Daniel Imms
2019-06-08 21:45:30 -07:00
7 changed files with 42 additions and 18 deletions
+4
View File
@@ -7,8 +7,11 @@ import { IBufferService, IOptionsService, ITerminalOptions, IPartialTerminalOpti
import { IEvent, EventEmitter } from 'common/EventEmitter';
import { clone } from 'common/Clone';
import { DEFAULT_OPTIONS } from 'common/services/OptionsService';
import { IBufferSet, IBuffer } from 'common/buffer/Types';
export class MockBufferService implements IBufferService {
public buffer: IBuffer = {} as any;
public buffers: IBufferSet = {} as any;
constructor(
public cols: number,
public rows: number
@@ -17,6 +20,7 @@ export class MockBufferService implements IBufferService {
this.cols = cols;
this.rows = rows;
}
reset(): void {}
}
export class MockOptionsService implements IOptionsService {
+5 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { IAttributeData, ICircularList, IBufferLine, ICellData } from 'common/Types';
import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker } from 'common/Types';
import { IEvent } from 'common/EventEmitter';
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
@@ -33,6 +33,7 @@ export interface IBuffer {
savedX: number;
savedCurAttrData: IAttributeData;
isCursorInViewport: boolean;
markers: IMarker[];
translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol?: number, endCol?: number): string;
getWrappedRangeForLine(y: number): { first: number, last: number };
nextStop(x?: number): number;
@@ -42,6 +43,7 @@ export interface IBuffer {
iterator(trimRight: boolean, startIndex?: number, endIndex?: number, startOverscan?: number, endOverscan?: number): IBufferStringIterator;
getNullCell(attr?: IAttributeData): ICellData;
getWhitespaceCell(attr?: IAttributeData): ICellData;
addMarker(y: number): IMarker;
}
export interface IBufferSet {
@@ -53,4 +55,6 @@ export interface IBufferSet {
activateNormalBuffer(): void;
activateAltBuffer(fillAttr?: IAttributeData): void;
resize(newCols: number, newRows: number): void;
setupTabStops(i?: number): void;
}
+14 -4
View File
@@ -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);
}
}
+4
View File
@@ -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 {