]>
Commit | Line | Data |
---|---|---|
95cb6f30 PK |
1 | /** |
2 | * @license MIT | |
3 | */ | |
4 | ||
5 | import { ITerminal } from './Interfaces'; | |
6 | import { Buffer } from './Buffer'; | |
8ede1fc9 | 7 | import { EventEmitter } from './EventEmitter'; |
95cb6f30 | 8 | |
8ede1fc9 | 9 | export class BufferSet extends EventEmitter { |
95cb6f30 PK |
10 | private _normal: Buffer; |
11 | private _alt: Buffer; | |
12 | private _activeBuffer: Buffer; | |
13 | ||
14 | constructor(private _terminal: ITerminal) { | |
8ede1fc9 | 15 | super(); |
95cb6f30 PK |
16 | this._normal = new Buffer(this._terminal); |
17 | this._alt = new Buffer(this._terminal); | |
18 | this._activeBuffer = this._normal; | |
19 | } | |
20 | ||
21 | public get alt(): Buffer { | |
22 | return this._alt; | |
23 | } | |
24 | ||
25 | public get active(): Buffer { | |
26 | return this._activeBuffer; | |
27 | } | |
28 | ||
29 | public get normal(): Buffer { | |
30 | return this._normal; | |
31 | } | |
32 | ||
95cb6f30 PK |
33 | public activateNormalBuffer(): void { |
34 | this._activeBuffer = this._normal; | |
6810de85 | 35 | this.emit('activate', this._normal); // todo maybe simpler this._terminal.buffer = this._terminal.buffers.normal than using EventEmitter? |
95cb6f30 PK |
36 | } |
37 | ||
38 | public activateAltBuffer(): void { | |
8ede1fc9 | 39 | this._activeBuffer = this._alt; |
6810de85 | 40 | this.emit('activate', this._alt); // todo maybe simpler this._terminal.buffer = this._terminal.buffers.alt than using EventEmitter? |
95cb6f30 PK |
41 | } |
42 | } |