]>
Commit | Line | Data |
---|---|---|
95cb6f30 PK |
1 | /** |
2 | * @license MIT | |
3 | */ | |
4 | ||
5 | import { ITerminal } from './Interfaces'; | |
6 | import { CircularList } from './utils/CircularList'; | |
7 | ||
bbafdd3d PK |
8 | /** |
9 | * This class represents a terminal buffer (an internal state of the terminal)/ | |
10 | */ | |
95cb6f30 | 11 | export class Buffer { |
de82bd00 | 12 | public lines: CircularList<string>; |
95cb6f30 | 13 | |
bbafdd3d PK |
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, | |
4626e19b PK |
28 | public scrollBottom: number = 0, |
29 | public scrollTop: number = 0, | |
30 | public tabs: any = {}, | |
bbafdd3d | 31 | ) { |
393b411a | 32 | this.lines = new CircularList<[string, number, string]>(this.terminal.scrollback); |
4626e19b | 33 | this.scrollBottom = this.terminal.rows - 1; |
95cb6f30 PK |
34 | } |
35 | } |