Start isolating buffer attributes into Buffer class

This commit is contained in:
Paris Kasidiaris
2017-07-16 03:47:15 +03:00
committed by Paris Kasidiaris
parent 8ede1fc9d2
commit bbafdd3d06
8 changed files with 222 additions and 242 deletions
+19 -6
View File
@@ -5,19 +5,32 @@
import { ITerminal } from './Interfaces';
import { CircularList } from './utils/CircularList';
/**
* This class represents a terminal buffer (an internal state of the terminal)/
*/
export class Buffer {
private _lines: CircularList<any>;
private _ybase: number;
private _ydisp: number;
private _y: number;
private _x: number;
private _tabs: any;
constructor(private terminal: ITerminal) {
/**
* Create a new Buffer.
* @param {Terminal} terminal - The terminal the buffer will belong to
* @param {number} ydisp - The scroll position of the buffer in the viewport
* @param {number} ybase - The scroll position of the y cursor (ybase + y = the y position within the buffer)
* @param {number} y - The cursor's y position after ybase
* @param {number} x - The cursor's x position after ybase
*/
constructor(
private terminal: ITerminal,
public ydisp: number = 0,
public ybase: number = 0,
public y: number = 0,
public x: number = 0,
) {
this._lines = new CircularList(this.terminal.scrollback);
}
public get lines(): CircularList {
public get lines(): CircularList<any> {
return this._lines;
}
}