Skip to content

Commit

Permalink
Refactor ANSI cursor code to use Deno.stdin.setRaw instead of Deno.se…
Browse files Browse the repository at this point in the history
…tRaw
  • Loading branch information
Shresht7 committed May 2, 2024
1 parent 1daa9d0 commit 0f1b898
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ansi/cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export default cursor
* @returns A tuple containing the current row and column of the cursor
*/
async function getPosition(): Promise<[number, number]> {
Deno.setRaw(Deno.stdin.rid, true)
Deno.stdin.setRaw(true)
write(cursor.requestPosition)
const response = await read(8)
Deno.setRaw(Deno.stdin.rid, false)
Deno.stdin.setRaw(false)

const [_, r, c] = response.match(/\[(\d+);(\d+)R/) ?? ['0', '0', '0']

Expand Down

0 comments on commit 0f1b898

Please sign in to comment.