update files

This commit is contained in:
nuintun 2015-11-24 19:18:48 +08:00
parent 29ec604905
commit 596b5eba3c
3 changed files with 49 additions and 13 deletions

View File

@ -419,8 +419,10 @@ header [class*=" icon-"] {
border-left: 1px solid #ccc; border-left: 1px solid #ccc;
} }
.ui-project-terminal { .ui-project-terminal {
padding: 0 10px;
background-color: #181818; background-color: #181818;
border-left: 1px dashed #ccc; border-left: 1px dashed #ccc;
font-family: Consolas, sans-serif;
} }
.ui-control-bar .ui-button-orange { .ui-control-bar .ui-button-orange {
margin: 0 10px 0 0; margin: 0 10px 0 0;

View File

@ -8,7 +8,7 @@ var fs = require('fs');
var path = require('path'); var path = require('path');
var util = require('../../util'); var util = require('../../util');
var Vue = require('../../vue/vue'); var Vue = require('../../vue/vue');
var Terminal = require('../../terminal/termlib'); var Terminal = require('../../terminal');
const EMPTYPROJECT = { const EMPTYPROJECT = {
name: '', name: '',
@ -80,13 +80,43 @@ module.exports = Vue.component('app-main', {
if (!window.AppRuntime[this.project.name]) { if (!window.AppRuntime[this.project.name]) {
var xterm = new Terminal({ var xterm = new Terminal({
x: 220, cols: 220,
y: 70, rows: 70
termDiv: this.$els.terminal
}); });
xterm.open(); xterm.open();
xterm.write('aasdsad'); this.$els.terminal.appendChild(xterm.element);
[
'\u001b[92m\'use strict\'\u001b[39m\u001b[90m;\u001b[39m',
'\u001b[90m/*jshint browser:true */\u001b[39m',
'',
'\u001b[32mvar\u001b[39m \u001b[37mTerminal\u001b[39m \u001b[93m=\u001b[39m \u001b[37mrequire\u001b[39m\u001b[90m(\u001b[39m\u001b[92m\'./term\'\u001b[39m\u001b[90m)\u001b[39m',
' \u001b[32m,\u001b[39m \u001b[37mthrough\u001b[39m \u001b[93m=\u001b[39m \u001b[37mrequire\u001b[39m\u001b[90m(\u001b[39m\u001b[92m\'through\'\u001b[39m\u001b[90m)\u001b[39m',
' \u001b[90m;\u001b[39m',
'',
'\u001b[37mmodule\u001b[39m\u001b[32m.\u001b[39m\u001b[37mexports\u001b[39m \u001b[93m=\u001b[39m \u001b[94mfunction\u001b[39m \u001b[90m(\u001b[39m\u001b[37mcols\u001b[39m\u001b[32m,\u001b[39m \u001b[37mrows\u001b[39m\u001b[32m,\u001b[39m \u001b[37mhandler\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m',
' \u001b[32mvar\u001b[39m \u001b[37mterm\u001b[39m \u001b[93m=\u001b[39m \u001b[31mnew\u001b[39m \u001b[37mTerminal\u001b[39m\u001b[90m(\u001b[39m\u001b[37mcols\u001b[39m\u001b[32m,\u001b[39m \u001b[37mrows\u001b[39m\u001b[32m,\u001b[39m \u001b[37mhandler\u001b[39m\u001b[90m)\u001b[39m\u001b[90m;\u001b[39m',
' \u001b[37mterm\u001b[39m\u001b[32m.\u001b[39m\u001b[37mopen\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m\u001b[90m;\u001b[39m',
' ',
' \u001b[32mvar\u001b[39m \u001b[37mhypernal\u001b[39m \u001b[93m=\u001b[39m \u001b[37mthrough\u001b[39m\u001b[90m(\u001b[39m\u001b[37mterm\u001b[39m\u001b[32m.\u001b[39m\u001b[37mwrite\u001b[39m\u001b[32m.\u001b[39m\u001b[37mbind\u001b[39m\u001b[90m(\u001b[39m\u001b[37mterm\u001b[39m\u001b[90m)\u001b[39m\u001b[90m)\u001b[39m\u001b[90m;\u001b[39m',
' \u001b[37mhypernal\u001b[39m\u001b[32m.\u001b[39m\u001b[37mappendTo\u001b[39m \u001b[93m=\u001b[39m \u001b[94mfunction\u001b[39m \u001b[90m(\u001b[39m\u001b[37melem\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m',
' \u001b[94mif\u001b[39m \u001b[90m(\u001b[39m\u001b[94mtypeof\u001b[39m \u001b[37melem\u001b[39m \u001b[93m===\u001b[39m \u001b[92m\'string\'\u001b[39m\u001b[90m)\u001b[39m \u001b[37melem\u001b[39m \u001b[93m=\u001b[39m \u001b[37mdocument\u001b[39m\u001b[32m.\u001b[39m\u001b[37mquerySelector\u001b[39m\u001b[90m(\u001b[39m\u001b[37melem\u001b[39m\u001b[90m)\u001b[39m\u001b[90m;\u001b[39m',
'',
' \u001b[37melem\u001b[39m\u001b[32m.\u001b[39m\u001b[37mappendChild\u001b[39m\u001b[90m(\u001b[39m\u001b[37mterm\u001b[39m\u001b[32m.\u001b[39m\u001b[37melement\u001b[39m\u001b[90m)\u001b[39m\u001b[90m;\u001b[39m',
' \u001b[37mterm\u001b[39m\u001b[32m.\u001b[39m\u001b[37melement\u001b[39m\u001b[32m.\u001b[39m\u001b[37mstyle\u001b[39m\u001b[32m.\u001b[39m\u001b[37mposition\u001b[39m \u001b[93m=\u001b[39m \u001b[92m\'relative\'\u001b[39m\u001b[90m;\u001b[39m',
' \u001b[33m}\u001b[39m\u001b[90m;\u001b[39m',
'',
' \u001b[37mhypernal\u001b[39m\u001b[32m.\u001b[39m\u001b[37mwriteln\u001b[39m \u001b[93m=\u001b[39m \u001b[94mfunction\u001b[39m \u001b[90m(\u001b[39m\u001b[37mline\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m',
' \u001b[37mterm\u001b[39m\u001b[32m.\u001b[39m\u001b[37mwriteln\u001b[39m\u001b[90m(\u001b[39m\u001b[37mline\u001b[39m\u001b[90m)\u001b[39m\u001b[90m;\u001b[39m',
' \u001b[33m}\u001b[39m\u001b[90m;\u001b[39m',
'',
' \u001b[37mhypernal\u001b[39m\u001b[32m.\u001b[39m\u001b[37mwrite\u001b[39m \u001b[93m=\u001b[39m \u001b[37mterm\u001b[39m\u001b[32m.\u001b[39m\u001b[37mwrite\u001b[39m\u001b[32m.\u001b[39m\u001b[37mbind\u001b[39m\u001b[90m(\u001b[39m\u001b[37mterm\u001b[39m\u001b[90m)\u001b[39m\u001b[90m;\u001b[39m',
'',
' \u001b[31mreturn\u001b[39m \u001b[37mhypernal\u001b[39m\u001b[90m;\u001b[39m',
'\u001b[33m}\u001b[39m\u001b[90m;\u001b[39m',
''
].forEach(function (line){ xterm.writeln(line); });
window.AppRuntime[this.project.name] = { window.AppRuntime[this.project.name] = {
name: name, name: name,

View File

@ -6,6 +6,7 @@ module.exports = Terminal;
function Terminal(opts){ function Terminal(opts){
opts = opts || {}; opts = opts || {};
if (!(this instanceof Terminal)) return new Terminal(opts); if (!(this instanceof Terminal)) return new Terminal(opts);
this.cols = opts.cols || 500; this.cols = opts.cols || 500;
@ -37,13 +38,13 @@ function Terminal(opts){
this.charsets = [null]; this.charsets = [null];
// misc // misc
this.element; this.element = null;
this.children; this.children = null;
this.refreshStart; this.refreshStart = null;
this.refreshEnd; this.refreshEnd = null;
this.savedX; this.savedX = null;
this.savedY; this.savedY = null;
this.savedCols; this.savedCols = null;
// stream // stream
this.readable = true; this.readable = true;
@ -58,12 +59,15 @@ function Terminal(opts){
this.postfix = ''; this.postfix = '';
this.lines = []; this.lines = [];
var i = this.rows; var i = this.rows;
while (i--) { while (i--) {
this.lines.push(this.blankLine()); this.lines.push(this.blankLine());
} }
this.tabs; this.tabs = null;
this.setupStops(); this.setupStops();
} }