Amended some default styling/befavior

- cursorBlink is not default from now on
- added some custom behavior in the demo
This commit is contained in:
paris 2014-03-24 16:53:33 +00:00
parent 0ae4b803cf
commit 7a6fb27a53
4 changed files with 30 additions and 4 deletions

View File

@ -1,8 +1,24 @@
var terminalContainer = document.getElementById('terminal-container'), 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.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.on('key', function (key, ev) {
term.write(data); 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);
}
}); });

View File

@ -12,9 +12,15 @@ h1 {
width: 960px; width: 960px;
height: 600px; height: 600px;
margin: 0 auto; margin: 0 auto;
padding: 2px;
} }
#terminal-container .terminal { #terminal-container .terminal {
background-color: #111; background-color: #111;
color: #fafafa; color: #fafafa;
padding: 2px;
}
#terminal-container .terminal .terminal-cursor {
background-color: #fafafa;
} }

View File

@ -40,4 +40,8 @@
color: #fff; color: #fff;
outline: none; outline: none;
font-family: courier-new, courier, monospace; font-family: courier-new, courier, monospace;
}
.terminal .terminal-cursor {
background-color: #fff;
} }

View File

@ -389,7 +389,7 @@ Terminal.defaults = {
convertEol: false, convertEol: false,
termName: 'xterm', termName: 'xterm',
geometry: [80, 24], geometry: [80, 24],
cursorBlink: true, cursorBlink: false,
visualBell: false, visualBell: false,
popOnBell: false, popOnBell: false,
scrollback: 1000, scrollback: 1000,