Created
December 31, 2025 01:51
-
-
Save hyrious/5570435abbfed1f07bc83f17195f18d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| process.stdout.write('\x1b[?25l' + '\x1b[30;40m' + '▽' + '\x1b[0m'); | |
| process.stdin.setRawMode(true); | |
| process.stdout.setNoDelay(true); | |
| process.stdout.write('\x1B[6n'); | |
| const rowcol = await new Promise(r => { | |
| let buf = ''; | |
| const onData = (data: Buffer) => { | |
| buf += data.toString('utf8'); | |
| const match = /\x1B\[(\d+);(\d+)R/.exec(buf); | |
| if (match) { | |
| process.stdin.off('data', onData); | |
| r([Number(match[1]) - 1, Number(match[2]) - 1]); | |
| } | |
| }; | |
| process.stdin.on('data', onData); | |
| }) | |
| process.stdin.setRawMode(false); | |
| process.stdout.write('\x1B[2K\r' + '\x1b[?25h'); | |
| process.stdout.setNoDelay(false); | |
| process.stdin.pause(); | |
| console.log(rowcol); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment