Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTY: Document WriteStream.cursorTo and others #22893

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions doc/api/tty.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,60 @@ added: v0.7.7
A `number` specifying the number of columns the TTY currently has. This property
is updated whenever the `'resize'` event is emitted.

### writeStream.cursorTo(x, y)
<!-- YAML
added: v0.7.7
-->

* `x` {number}
* `y` {number}

`writeStream.cursorTo` moves this `WriteStream`'s cursor to the specified
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`writeStream.cursorTo` -> `writeStream.cursorTo()` as per our doc/STYLE_GUIDE.md. The same for the method mentions below.

position.

### writeStream.moveCursor(dx, dy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc sections need to be ABC-sorted by their headings.

<!-- YAML
added: v0.7.7
-->

* `dx` {number}
* `dy` {number}

`writeStream.moveCursor` moves this `WriteStream`'s cursor *relative* to its
current position.

### writeStream.clearLine(dir)
<!-- YAML
added: v0.7.7
-->

* `dir` {number}
* `-1` - to the left from cursor
* `1` - to the right from cursor
* `0` - the entire line

`writeStream.clearLine` clears the current line of this `WriteStream` in a
direction identified by `dir`.

### writeStream.clearScreenDown()
<!-- YAML
added: v0.7.7
-->

`writeStream.clearScreenDown` clears this `WriteStream` from the current
cursor down.

### writeStream.getWindowSize()
<!-- YAML
added: v0.7.7
-->
* Returns: {array}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{array} -> {Array} (non-primitive types are uppercased).
Or maybe, as we know the array's elements type, we can make this {number[]}.


`writeStream.getWindowSize` returns the size of the [TTY]() corresponding
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the link should be [TTY](tty.html) or [TTY](#tty_tty) here and below.

to this `WriteStream`. The array is of the type `[numColumns, numRows]`
where `numColumns` and `numRows` represents the number of columns and rows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

represents -> represent.

in the corresponding [TTY]().

### writeStream.isTTY
<!-- YAML
added: v0.5.8
Expand Down