]> git.proxmox.com Git - mirror_xterm.js.git/blob - src/Buffer.ts
Improve documentation of `Buffer` and `BufferSet` classes
[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), where the
10 * following information is stored (in high-level):
11 * - text content of this particular buffer
12 * - cursor position
13 * - scroll position
14 */
15 export class Buffer {
16 public lines: CircularList<[string, number, string]>;
17
18 /**
19 * Create a new Buffer.
20 * @param {Terminal} terminal - The terminal the Buffer will belong to
21 * @param {number} ydisp - The scroll position of the Buffer in the viewport
22 * @param {number} ybase - The scroll position of the y cursor (ybase + y = the y position within the Buffer)
23 * @param {number} y - The cursor's y position after ybase
24 * @param {number} x - The cursor's x position after ybase
25 */
26 constructor(
27 private terminal: ITerminal,
28 public ydisp: number = 0,
29 public ybase: number = 0,
30 public y: number = 0,
31 public x: number = 0,
32 public scrollBottom: number = 0,
33 public scrollTop: number = 0,
34 public tabs: any = {},
35 ) {
36 this.lines = new CircularList<[string, number, string]>(this.terminal.scrollback);
37 this.scrollBottom = this.terminal.rows - 1;
38 }
39 }