mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Update node test
This commit is contained in:
+5
-5
@@ -1,12 +1,12 @@
|
||||
import { createRequire } from 'module';
|
||||
const require = createRequire(import.meta.url);
|
||||
const xterm = require('xterm-core');
|
||||
const Terminal = require('../lib-headless/xterm.js').Terminal;
|
||||
|
||||
console.log('Creating xterm-core terminal...');
|
||||
const terminal = new xterm.Terminal();
|
||||
const terminal = new Terminal();
|
||||
console.log('Writing `ls` to terminal...')
|
||||
terminal.write('ls', () => {
|
||||
terminal.write('foo \x1b[1;31mbar\x1b[0m baz', () => {
|
||||
const bufferLine = terminal.buffer.normal.getLine(terminal.buffer.normal.cursorY);
|
||||
const contents = bufferLine.translateToString();
|
||||
console.log(`Contents of terminal active buffer are: ${contents}`); // ls
|
||||
const contents = bufferLine.translateToString(true);
|
||||
console.log(`Contents of terminal active buffer are: ${contents}`); // foo bar baz
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user