]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/Buffer.ts
Start isolating buffer attributes into Buffer class
[mirror_xterm.js.git] / src / Buffer.ts
index ba147d81086919dc255f4d2a2f18703776b53d83..32a406a6c547119fa1377e455d3fc277a713ce82 100644 (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;
   }
 }