Add comments explaining actions preventing x from wrapping

This commit is contained in:
Daniel Imms
2017-01-25 10:34:43 -08:00
parent b789a7e85b
commit 5850cbcd05
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -123,6 +123,7 @@ export class InputHandler implements IInputHandler {
this._terminal.y--;
this._terminal.scroll();
}
// If the end of the line is hit, prevent this action from wrapping around to the next line.
if (this._terminal.x >= this._terminal.cols) {
this._terminal.x--;
}
@@ -220,6 +221,7 @@ export class InputHandler implements IInputHandler {
if (this._terminal.y >= this._terminal.rows) {
this._terminal.y = this._terminal.rows - 1;
}
// If the end of the line is hit, prevent this action from wrapping around to the next line.
if (this._terminal.x >= this._terminal.cols) {
this._terminal.x--;
}
@@ -249,6 +251,7 @@ export class InputHandler implements IInputHandler {
if (param < 1) {
param = 1;
}
// If the end of the line is hit, prevent this action from wrapping around to the next line.
if (this._terminal.x >= this._terminal.cols) {
this._terminal.x--;
}
@@ -701,6 +704,7 @@ export class InputHandler implements IInputHandler {
if (this._terminal.y >= this._terminal.rows) {
this._terminal.y = this._terminal.rows - 1;
}
// If the end of the line is hit, prevent this action from wrapping around to the next line.
if (this._terminal.x >= this._terminal.cols) {
this._terminal.x--;
}
+1
View File
@@ -2303,6 +2303,7 @@ Terminal.prototype.index = function() {
this.y--;
this.scroll();
}
// If the end of the line is hit, prevent this action from wrapping around to the next line.
if (this.x >= this.cols) {
this.x--;
}