From e2215a3413621ccf7d4552f2897ce374f6294e97 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sun, 3 Jul 2016 14:11:45 -0700 Subject: [PATCH] term: fix edge case when clearing after a screen clear --- app/term.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/term.js b/app/term.js index f250630b..c511f683 100644 --- a/app/term.js +++ b/app/term.js @@ -145,20 +145,20 @@ export default class Term extends Component { const x = screen.cursorPosition.column; const y = screen.cursorPosition.row; - if (y === 0) { + if (x === 0) { // Empty screen, nothing to do. return; } - for (let i = 0; i < y; i++) { - screen.setCursorPosition(i, 0); - screen.clearCursorRow(); - } - // here we move the row that the user was focused on // to the top of the screen term.moveRows_(y, 1, 0); + for (let i = 1; i < bottom; i++) { + screen.setCursorPosition(i, 0); + screen.clearCursorRow(); + } + // we restore the cursor position screen.setCursorPosition(0, x); }