var terminalContainer = document.getElementById('terminal-container'),
- term = new Terminal({geometry: [60, 37]});
+ term = new Terminal({geometry: [95, 37]});
+
+term.prompt = function () {
+ term.write('> ');
+}
term.open(terminalContainer);
+term.writeln('Welcome to xterm.js');
+term.writeln('Just type some keys in the prompt below.');
+term.writeln('');
+term.prompt();
-term.on('data', function (data) {
- term.write(data);
+term.on('key', function (key, ev) {
+ console.log(this, key, ev);
+ if (ev.keyIdentifier == 'Enter') {
+ term.writeln('');
+ term.prompt();
+ } if (ev.keyCode == 8) {
+ term.write('\b \b');
+ }else {
+ term.write(key);
+ }
});
\ No newline at end of file
width: 960px;
height: 600px;
margin: 0 auto;
+ padding: 2px;
}
#terminal-container .terminal {
background-color: #111;
color: #fafafa;
+ padding: 2px;
+}
+
+#terminal-container .terminal .terminal-cursor {
+ background-color: #fafafa;
}
\ No newline at end of file
color: #fff;
outline: none;
font-family: courier-new, courier, monospace;
+}
+
+.terminal .terminal-cursor {
+ background-color: #fff;
}
\ No newline at end of file