onDidWrite property
An event that when fired will write data to the terminal. Unlike {@link Terminal.sendText} which sends text to the underlying child pseudo-device (the child), this will write the text to parent pseudo-device (the terminal itself).
Note writing \n
will just move the cursor down 1 row, you need to write \r
as well
to move the cursor to the left-most cell.
Events fired before {@link Pseudoterminal.open} is called will be be ignored.
Example: Write red text to the terminal
const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
onDidWrite: writeEmitter.event,
open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
Example: Move the cursor to the 10th row and 20th column and write an asterisk
writeEmitter.fire('\x1b[10;20H*');
Implementation
_i3.Event<_i2.String> get onDidWrite => _i5.getProperty(
this,
'onDidWrite',
);