Deno: feat: stdout.cursorTo()

Created on 14 Jul 2020  路  3Comments  路  Source: denoland/deno

I鈥檝e been working on a test system for native ESM tests and just got the runner working on Deno, but I did have to use a version of the runner鈥檚 display code that is less than awesome because there鈥檚 currently no way in Deno to move the stdout cursor.

I don鈥檛 have a strong opinion about where the API lives or how it should work, only that the functionality is there. In node.js it鈥檚 at process.stdout.cursorTo() but I don鈥檛 know if you want to copy that pattern. Adding properties to the stream seems a little off to me, and if you aren鈥檛 going to support the entire API surface that Node.js has here for tty it鈥檚 probably best to diverge completely.

Most helpful comment

Probably we should start std/ansi (std/term ? std/tty ?) where we can have functions for various things like this.

All 3 comments

Probably we should start std/ansi (std/term ? std/tty ?) where we can have functions for various things like this.

Adding properties to streams, or extending Deno.Writer/Reader/Duplex might be inevitable since, surprisingly, stdin/stdout/stderr aren't the only terminal streams Deno can open. See #6706. In linux, for example, one can open /dev/tty, and, if given the perms, any tty on the system. Not sure how it works in windows, but it's likely possible as well.

Do we want to implement this as syscall ops or escape sequences?

Has been some grievance from users that escape sequences (std/fmt) don't work with (what I consider) outdated terminal emulators.

I think we reached a consensus that we won't go out of our way to support inferior terminal emulators on Windows since modern Windows does support it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kitsonk picture kitsonk  路  3Comments

zugende picture zugende  路  3Comments

xueqingxiao picture xueqingxiao  路  3Comments

watilde picture watilde  路  3Comments

JosephAkayesi picture JosephAkayesi  路  3Comments