]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Amended some default styling/befavior
authorparis <pariskasidiaris@gmail.com>
Mon, 24 Mar 2014 16:53:33 +0000 (16:53 +0000)
committerparis <pariskasidiaris@gmail.com>
Mon, 24 Mar 2014 16:53:33 +0000 (16:53 +0000)
- cursorBlink is not default from now on
- added some custom behavior in the demo

demo/main.js
demo/style.css
src/xterm.css
src/xterm.js

index a57c6806eb1c756d9034f27c9a7d1099ce69cb2a..05a7d151ca171158c06189116fffe3b909517908 100644 (file)
@@ -1,8 +1,24 @@
 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
index 7ed117b2c9a4dabadb561071e9943ce16e8002be..6ed5d25bbd42d9e25ad088450346a23ff90819c6 100644 (file)
@@ -12,9 +12,15 @@ h1 {
     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
index 41ba490472eaf3814b161100b927d0d039b79b10..86d22b262f70a1ea993d01558802d5f14755abd6 100644 (file)
@@ -40,4 +40,8 @@
     color: #fff;
     outline: none;
     font-family: courier-new, courier, monospace;
+}
+
+.terminal .terminal-cursor {
+    background-color: #fff;
 }
\ No newline at end of file
index 9dafc1f0863c6527b5895141f952e0a424ac881f..bec7234dd8c0d44a2ba08aa7dd6455f91553e60c 100644 (file)
@@ -389,7 +389,7 @@ Terminal.defaults = {
   convertEol: false,
   termName: 'xterm',
   geometry: [80, 24],
-  cursorBlink: true,
+  cursorBlink: false,
   visualBell: false,
   popOnBell: false,
   scrollback: 1000,