Move resize event into bufferservice
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
import { BufferSet } from 'common/buffer/BufferSet';
|
||||
import { IBufferSet, IBuffer } from 'common/buffer/Types';
|
||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||
|
||||
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
||||
export const MINIMUM_ROWS = 1;
|
||||
@@ -17,6 +18,9 @@ export class BufferService implements IBufferService {
|
||||
public rows: number;
|
||||
public buffers: IBufferSet;
|
||||
|
||||
private _onResize = new EventEmitter<{ cols: number, rows: number }>();
|
||||
public get onResize(): IEvent<{ cols: number, rows: number }> { return this._onResize.event; }
|
||||
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
|
||||
constructor(
|
||||
@@ -32,6 +36,7 @@ export class BufferService implements IBufferService {
|
||||
this.rows = rows;
|
||||
this.buffers.resize(cols, rows);
|
||||
this.buffers.setupTabStops(this.cols);
|
||||
this._onResize.fire({ cols, rows });
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface IBufferService {
|
||||
readonly buffer: IBuffer;
|
||||
readonly buffers: IBufferSet;
|
||||
|
||||
// TODO: Move resize event here
|
||||
onResize: IEvent<{ cols: number, rows: number }>;
|
||||
|
||||
resize(cols: number, rows: number): void;
|
||||
reset(): void;
|
||||
|
||||
Reference in New Issue
Block a user