Skip to content

Commit

Permalink
TTY: Document WriteStream.cursorTo and others
Browse files Browse the repository at this point in the history
Adds documentation for the following WriteStream instance methods:
- cursorTo
- moveCursor
- clearLine
- clearScreenDown
- getWindowSize

Fixes nodejs#9853.
  • Loading branch information
ur0 authored Sep 17, 2018
1 parent 1747d70 commit 2621840
Showing 1 changed file with 54 additions and 0 deletions.
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
position.

### writeStream.moveCursor(dx, dy)
<!-- 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}

`writeStream.getWindowSize` returns the size of the [TTY]() corresponding
to this `WriteStream`. The array is of the type `[numColumns, numRows]`
where `numColumns` and `numRows` represents the number of columns and rows
in the corresponding [TTY]().

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

0 comments on commit 2621840

Please sign in to comment.