]> git.proxmox.com Git - mirror_xterm.js.git/blame - src/BufferSet.ts
Fix turning from alt screen to normal screen and vice versa. Fix https://github.com...
[mirror_xterm.js.git] / src / BufferSet.ts
CommitLineData
95cb6f30
PK
1/**
2 * @license MIT
3 */
4
5import { ITerminal } from './Interfaces';
6import { Buffer } from './Buffer';
8ede1fc9 7import { EventEmitter } from './EventEmitter';
95cb6f30 8
8ede1fc9 9export 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}