Skip to content

Commit

Permalink
fix(ansi): make getCursorPosition options optional (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Mar 16, 2021
1 parent e91d651 commit 2e7c35d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ansi/cursor_position.ts
Expand Up @@ -20,9 +20,12 @@ export interface CursorPositionOptions {
* console.log(cursor); // { x: 0, y: 14}
* ```
*/
export function getCursorPosition(options: CursorPositionOptions): Cursor {
const stdout: Deno.WriterSync = options?.stdout ?? Deno.stdout;
const stdin: Deno.ReaderSync & { rid: number } = options?.stdin ?? Deno.stdin;
export function getCursorPosition(
{
stdin = Deno.stdin,
stdout = Deno.stdout,
}: CursorPositionOptions = {},
): Cursor {
const data = new Uint8Array(8);

Deno.setRaw(stdin.rid, true);
Expand Down

0 comments on commit 2e7c35d

Please sign in to comment.