]> git.proxmox.com Git - mirror_xterm.js.git/blob - src/BufferSet.ts
Introduce new Buffer and BufferSet classes
[mirror_xterm.js.git] / src / BufferSet.ts
1 /**
2 * @license MIT
3 */
4
5 import { ITerminal } from './Interfaces';
6 import { Buffer } from './Buffer';
7
8 export class BufferSet {
9 private _normal: Buffer;
10 private _alt: Buffer;
11 private _activeBuffer: Buffer;
12
13 constructor(private _terminal: ITerminal) {
14 this._normal = new Buffer(this._terminal);
15 this._alt = new Buffer(this._terminal);
16 this._activeBuffer = this._normal;
17 }
18
19 public get alt(): Buffer {
20 return this._alt;
21 }
22
23 public get active(): Buffer {
24 return this._activeBuffer;
25 }
26
27 public get normal(): Buffer {
28 return this._normal;
29 }
30
31 private resetTerminal() {
32 this._terminal.reset();
33 this._terminal.viewport.syncScrollArea();
34 this._terminal.showCursor();
35 }
36
37 public activateNormalBuffer(): void {
38 this._activeBuffer = this._normal;
39 }
40
41 public activateAltBuffer(): void {
42 this._activeBuffer = this._normal;
43 }
44 }