Fix moveToCell when target is beyond buffer

This commit is contained in:
kumaran-14
2020-02-02 23:28:24 +05:30
parent af67b72492
commit b591ccc40d
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ export function moveToCellSequence(targetX: number, targetY: number, bufferServi
}
direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;
return repeat(colsFromRowEnd(startY > targetY ? targetX : startX, bufferService), sequence(direction, applicationCursor))
+ repeat((Math.abs(wrappedRowsForRow(bufferService, startY) - wrappedRowsForRow(bufferService, targetY)) - 1 ) * bufferService.cols, sequence(direction, applicationCursor))
+ repeat((Math.abs(startY - targetY) - 1 ) * bufferService.cols, sequence(direction, applicationCursor))
+ repeat(colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService), sequence(direction, applicationCursor));
}