]> git.proxmox.com Git - mirror_xterm.js.git/blame - src/Buffer.ts
Start isolating buffer attributes into Buffer class
[mirror_xterm.js.git] / src / Buffer.ts
CommitLineData
95cb6f30
PK
1/**
2 * @license MIT
3 */
4
5import { ITerminal } from './Interfaces';
6import { CircularList } from './utils/CircularList';
7
bbafdd3d
PK
8/**
9 * This class represents a terminal buffer (an internal state of the terminal)/
10 */
95cb6f30
PK
11export class Buffer {
12 private _lines: CircularList<any>;
95cb6f30
PK
13 private _tabs: any;
14
bbafdd3d
PK
15 /**
16 * Create a new Buffer.
17 * @param {Terminal} terminal - The terminal the buffer will belong to
18 * @param {number} ydisp - The scroll position of the buffer in the viewport
19 * @param {number} ybase - The scroll position of the y cursor (ybase + y = the y position within the buffer)
20 * @param {number} y - The cursor's y position after ybase
21 * @param {number} x - The cursor's x position after ybase
22 */
23 constructor(
24 private terminal: ITerminal,
25 public ydisp: number = 0,
26 public ybase: number = 0,
27 public y: number = 0,
28 public x: number = 0,
29 ) {
95cb6f30
PK
30 this._lines = new CircularList(this.terminal.scrollback);
31 }
32
bbafdd3d 33 public get lines(): CircularList<any> {
95cb6f30
PK
34 return this._lines;
35 }
36}