]> git.proxmox.com Git - mirror_xterm.js.git/blob - src/Buffer.ts
Fix some tests and docs, little code fix up.
[mirror_xterm.js.git] / src / Buffer.ts
1 /**
2 * @license MIT
3 */
4
5 import { ITerminal } from './Interfaces';
6 import { CircularList } from './utils/CircularList';
7
8 /**
9 * This class represents a terminal buffer (an internal state of the terminal)/
10 */
11 export class Buffer {
12 public lines: CircularList<string>;
13
14 /**
15 * Create a new Buffer.
16 * @param {Terminal} terminal - The terminal the buffer will belong to
17 * @param {number} ydisp - The scroll position of the buffer in the viewport
18 * @param {number} ybase - The scroll position of the y cursor (ybase + y = the y position within the buffer)
19 * @param {number} y - The cursor's y position after ybase
20 * @param {number} x - The cursor's x position after ybase
21 */
22 constructor(
23 private terminal: ITerminal,
24 public ydisp: number = 0,
25 public ybase: number = 0,
26 public y: number = 0,
27 public x: number = 0,
28 public scrollBottom: number = 0,
29 public scrollTop: number = 0,
30 public tabs: any = {},
31 ) {
32 this.lines = new CircularList<string>(this.terminal.scrollback);
33 this.scrollBottom = this.terminal.rows - 1;
34 }
35 }