term: fix edge case when clearing after a screen clear

This commit is contained in:
Guillermo Rauch 2016-07-03 14:11:45 -07:00
parent d8e841a3d8
commit e2215a3413

View file

@ -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);
}