(s, key)
| 1255 | |
| 1256 | // Handle a write from the tty |
| 1257 | [kTtyWrite](s, key) { |
| 1258 | const previousKey = this[kPreviousKey]; |
| 1259 | key ||= kEmptyObject; |
| 1260 | this[kPreviousKey] = key; |
| 1261 | let shouldResetPreviousCursorCols = true; |
| 1262 | |
| 1263 | if (!key.meta || key.name !== 'y') { |
| 1264 | // Reset yanking state unless we are doing yank pop. |
| 1265 | this[kYanking] = false; |
| 1266 | } |
| 1267 | |
| 1268 | // Activate or deactivate substring search. |
| 1269 | if ( |
| 1270 | (key.name === 'up' || key.name === 'down') && |
| 1271 | !key.ctrl && |
| 1272 | !key.meta && |
| 1273 | !key.shift |
| 1274 | ) { |
| 1275 | if (this[kSubstringSearch] === null && !this[kIsMultiline]) { |
| 1276 | this[kSubstringSearch] = StringPrototypeSlice( |
| 1277 | this.line, |
| 1278 | 0, |
| 1279 | this.cursor, |
| 1280 | ); |
| 1281 | } |
| 1282 | } else if (this[kSubstringSearch] !== null) { |
| 1283 | this[kSubstringSearch] = null; |
| 1284 | // Reset the index in case there's no match. |
| 1285 | if (this.history.length === this.historyIndex) { |
| 1286 | this.historyIndex = -1; |
| 1287 | } |
| 1288 | } |
| 1289 | |
| 1290 | // Undo & Redo |
| 1291 | if (typeof key.sequence === 'string') { |
| 1292 | switch (StringPrototypeCodePointAt(key.sequence, 0)) { |
| 1293 | case 0x1f: |
| 1294 | this[kUndo](); |
| 1295 | return; |
| 1296 | case 0x1e: |
| 1297 | this[kRedo](); |
| 1298 | return; |
| 1299 | default: |
| 1300 | break; |
| 1301 | } |
| 1302 | } |
| 1303 | |
| 1304 | // Ignore escape key, fixes |
| 1305 | // https://github.com/nodejs/node-v0.x-archive/issues/2876. |
| 1306 | if (key.name === 'escape') return; |
| 1307 | |
| 1308 | if (key.ctrl && key.shift) { |
| 1309 | /* Control and shift pressed */ |
| 1310 | switch (key.name) { |
| 1311 | // TODO(BridgeAR): The transmitted escape sequence is `\b` and that is |
| 1312 | // identical to <ctrl>-h. It should have a unique escape sequence. |
| 1313 | case 'backspace': |
| 1314 | this[kDeleteLineLeft](); |
nothing calls this directly
no test coverage detected