]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/InputHandler.ts
Merge pull request #926 from ficristo/search-fix
[mirror_xterm.js.git] / src / InputHandler.ts
index 449a9399b974f12d360b137ff9af3c77d34470dc..b915f2c0b942fc7053cfd152e36486a7eb610c4c 100644 (file)
@@ -948,12 +948,12 @@ export class InputHandler implements IInputHandler {
           this._terminal.cursorHidden = false;
           break;
         case 1049: // alt screen buffer cursor
-          this.saveCursor(params);
+          // TODO: Not sure if we need to save/restore after switching the buffer
+          // this.saveCursor(params);
           // FALL-THROUGH
         case 47: // alt screen buffer
         case 1047: // alt screen buffer
           this._terminal.buffers.activateAltBuffer();
-          this._terminal.reset();
           this._terminal.viewport.syncScrollArea();
           this._terminal.showCursor();
           break;
@@ -1118,9 +1118,10 @@ export class InputHandler implements IInputHandler {
         case 1047: // normal screen buffer - clearing it first
           // Ensure the selection manager has the correct buffer
           this._terminal.buffers.activateNormalBuffer();
-          if (params[0] === 1049) {
-            this.restoreCursor(params);
-          }
+          // TODO: Not sure if we need to save/restore after switching the buffer
+          // if (params[0] === 1049) {
+          //   this.restoreCursor(params);
+          // }
           this._terminal.selectionManager.setBuffer(this._terminal.buffer.lines);
           this._terminal.refresh(0, this._terminal.rows - 1);
           this._terminal.viewport.syncScrollArea();
@@ -1453,8 +1454,8 @@ export class InputHandler implements IInputHandler {
    *   Save cursor (ANSI.SYS).
    */
   public saveCursor(params: number[]): void {
-    this._terminal.buffers.active.x = this._terminal.buffer.x;
-    this._terminal.buffers.active.y = this._terminal.buffer.y;
+    this._terminal.buffer.savedX = this._terminal.buffer.x;
+    this._terminal.buffer.savedY = this._terminal.buffer.y;
   }
 
 
@@ -1463,8 +1464,8 @@ export class InputHandler implements IInputHandler {
    *   Restore cursor (ANSI.SYS).
    */
   public restoreCursor(params: number[]): void {
-    this._terminal.buffer.x = this._terminal.buffers.active.x || 0;
-    this._terminal.buffer.y = this._terminal.buffers.active.y || 0;
+    this._terminal.buffer.x = this._terminal.buffer.savedX || 0;
+    this._terminal.buffer.y = this._terminal.buffer.savedY || 0;
   }
 }