]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/Viewport.ts
Merge pull request #926 from ficristo/search-fix
[mirror_xterm.js.git] / src / Viewport.ts
index 5be6bffdfbb411bec5c91ea05538fcc5d2903b5d..fe276935bb7b507f67f115598c038e53c12b398a 100644 (file)
@@ -20,7 +20,7 @@ export class Viewport {
    * @param terminal The terminal this viewport belongs to.
    * @param viewportElement The DOM element acting as the viewport.
    * @param scrollArea The DOM element acting as the scroll area.
-   * @param charMeasureElement A DOM element used to measure the character size of. the terminal.
+   * @param charMeasure A DOM element used to measure the character size of. the terminal.
    */
   constructor(
     private terminal: ITerminal,
@@ -43,8 +43,6 @@ export class Viewport {
   /**
    * Refreshes row height, setting line-height, viewport height and scroll area height if
    * necessary.
-   * @param charSize A character size measurement bounding rect object, if it doesn't exist it will
-   *   be created.
    */
   private refresh(): void {
     if (this.charMeasure.height > 0) {
@@ -68,9 +66,9 @@ export class Viewport {
    * Updates dimensions and synchronizes the scroll area if necessary.
    */
   public syncScrollArea(): void {
-    if (this.lastRecordedBufferLength !== this.terminal.lines.length) {
+    if (this.lastRecordedBufferLength !== this.terminal.buffer.lines.length) {
       // If buffer height changed
-      this.lastRecordedBufferLength = this.terminal.lines.length;
+      this.lastRecordedBufferLength = this.terminal.buffer.lines.length;
       this.refresh();
     } else if (this.lastRecordedViewportHeight !== this.terminal.rows) {
       // If viewport height changed
@@ -83,7 +81,7 @@ export class Viewport {
     }
 
     // Sync scrollTop
-    const scrollTop = this.terminal.ydisp * this.currentRowHeight;
+    const scrollTop = this.terminal.buffer.ydisp * this.currentRowHeight;
     if (this.viewportElement.scrollTop !== scrollTop) {
       this.viewportElement.scrollTop = scrollTop;
     }
@@ -96,7 +94,7 @@ export class Viewport {
    */
   private onScroll(ev: Event) {
     const newRow = Math.round(this.viewportElement.scrollTop / this.currentRowHeight);
-    const diff = newRow - this.terminal.ydisp;
+    const diff = newRow - this.terminal.buffer.ydisp;
     this.terminal.scrollDisp(diff, true);
   }