Skip to content

Commit 22fe0a0

Browse files
authored
Merge pull request #335 from MatzElectronics/solo-332-terminalPreventCursorPositionFromGoingNegative
Solo 332 terminal prevent cursor position from going negative
2 parents 2cb3e57 + d495c2d commit 22fe0a0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/propterm.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,14 @@ class PropTerm {
334334
this.buffer.textArray[this.cursor.y] = '';
335335
}
336336

337-
if (this.cursor.x < 0) {
337+
if (this.cursor.x < 0 && this.cursor.y > 0) {
338338
this.cursor.y--;
339339
this.cursor.x = this.buffer.textArray[this.cursor.y].length;
340340
if (this.cursor.x > this.size.charactersWide - 1) {
341341
this.cursor.x = this.size.charactersWide - 1;
342342
this.buffer.textArray[this.cursor.y] = this.buffer.textArray[this.cursor.y].substr(0, this.cursor.x);
343343
}
344-
}
345-
346-
if (this.cursor.y < 0) {
347-
this.cursor.y = 0;
344+
} else if (this.cursor.x < 0) {
348345
this.cursor.x = 0;
349346
}
350347

0 commit comments

Comments
 (0)