Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit f0cdbbf

Browse files
committed
Fix the issue when cursor could have been moved to a negative position.
Apt sends an incorrect column 0 instead of 1: e.g. `sudo apt install emacs`.
1 parent 9cb695c commit f0cdbbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Cursor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export class Cursor {
77

88
moveAbsolute(position: PartialRowColumn, homePosition: RowColumn): this {
99
if (typeof position.column === "number") {
10-
this.position.column = position.column + homePosition.column;
10+
this.position.column = Math.max(position.column, 0) + homePosition.column;
1111
}
1212

1313
if (typeof position.row === "number") {
14-
this.position.row = position.row + homePosition.row;
14+
this.position.row = Math.max(position.row, 0) + homePosition.row;
1515
}
1616

1717
return this;

0 commit comments

Comments
 (0)