Skip to content

Commit 1c0e5d3

Browse files
tty: use raw as public raw mode name
Signed-off-by: Samuel Williams <samuel.williams@shopify.com>
1 parent e0d8bf1 commit 1c0e5d3

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎doc/api/tty.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ added: v0.7.7
7272
changes:
7373
- version: REPLACEME
7474
pr-url: https://github.com/nodejs/node/pull/64140
75-
description: The `mode` argument supports `'raw-vt'` and `'io'`.
75+
description: The `mode` argument supports `'raw'` and `'io'`.
7676
-->
7777

78-
* `mode` {boolean|string} If `true` or `'raw-vt'`, configures the
78+
* `mode` {boolean|string} If `true` or `'raw'`, configures the
7979
`tty.ReadStream` to operate as a raw device. If `'io'`, configures the
8080
`tty.ReadStream` to operate in binary-safe I/O mode. If `false`, configures
8181
the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
@@ -105,8 +105,8 @@ added: REPLACEME
105105
* {boolean|string}
106106

107107
The current raw mode for the `tty.ReadStream`. This is `false` when the stream
108-
is in its default mode, `'raw-vt'` when raw input mode is enabled, and `'io'`
109-
when binary-safe I/O mode is enabled.
108+
is in its default mode, `'raw'` when raw input mode is enabled, and `'io'` when
109+
binary-safe I/O mode is enabled.
110110

111111
## Class: `tty.WriteStream`
112112

‎lib/tty.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ ObjectSetPrototypeOf(ReadStream.prototype, net.Socket.prototype);
8282
ObjectSetPrototypeOf(ReadStream, net.Socket);
8383

8484
ReadStream.prototype.setRawMode = function(mode) {
85-
const rawMode = mode === 'io' ? 'io' : (mode ? 'raw-vt' : false);
85+
const rawMode = mode === 'io' ? 'io' : (mode ? 'raw' : false);
8686
let ttyMode = UV_TTY_MODE_NORMAL;
8787
if (rawMode === 'io') {
8888
ttyMode = UV_TTY_MODE_IO;
89-
} else if (rawMode === 'raw-vt') {
89+
} else if (rawMode === 'raw') {
9090
ttyMode = UV_TTY_MODE_RAW_VT;
9191
}
9292
const err = this._handle?.setRawMode(ttyMode);

‎test/pseudo-tty/test-set-raw-mode-modes.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ function isOnlcrEnabled() {
1616
process.stdin.setRawMode(true);
1717
console.log(`raw=${isOnlcrEnabled()}`);
1818
assert.strictEqual(process.stdin.isRaw, true);
19-
assert.strictEqual(process.stdin.rawMode, 'raw-vt');
19+
assert.strictEqual(process.stdin.rawMode, 'raw');
2020

2121
process.stdin.setRawMode(false);
2222
console.log(`normal=${process.stdin.isRaw}`);
2323
assert.strictEqual(process.stdin.rawMode, false);
2424

25-
process.stdin.setRawMode('raw-vt');
26-
console.log(`raw-vt=${isOnlcrEnabled()}`);
25+
process.stdin.setRawMode('raw');
26+
console.log(`raw-string=${isOnlcrEnabled()}`);
2727
assert.strictEqual(process.stdin.isRaw, true);
28-
assert.strictEqual(process.stdin.rawMode, 'raw-vt');
28+
assert.strictEqual(process.stdin.rawMode, 'raw');
2929

3030
process.stdin.setRawMode(false);
3131
process.stdin.setRawMode('io');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
raw=true
22
normal=false
3-
raw-vt=true
3+
raw-string=true
44
io=false

0 commit comments

Comments
 (0)