update files

This commit is contained in:
nuintun 2015-11-25 11:52:39 +08:00
parent e90d05c1bc
commit abaea8ed18
3 changed files with 5 additions and 28 deletions

View File

@ -121,17 +121,17 @@ module.exports = function (Terminal){
switch (ch) {
case '&':
out += '&';
out += '&';
break;
case '<':
out += '<';
out += '&lt;';
break;
case '>':
out += '>';
break;
default:
if (ch <= ' ') {
out += '&nbsp;';
out += '&gt;';
} else {
if (this.isWide(ch)) i++;

View File

@ -13,6 +13,8 @@ module.exports = function (Terminal){
this.lines = this.lines.slice(-(this.ybase + this.rows) + 1);
}
console.log(this.ybase, this.scrollback);
this.ydisp = this.ybase;
// last line

View File

@ -10,30 +10,6 @@ function fixLinefeed(data){
return data.replace(/([^\r])\n/g, '$1\r\n');
}
function fixIndent(data){
if (!/(^|\n) /.test(data)) return data;
// not very efficient, but works and would only become a problem
// once we render huge amounts of data
return data
.split('\n')
.map(function (line){
var count = 0;
while (line.charAt(0) === ' ') {
line = line.slice(1);
count++;
}
while (count--) {
line = '&nbsp;' + line;
}
return line;
})
.join('\r\n');
}
module.exports = function (Terminal){
Terminal.prototype.bell = function (){
var snd = new Audio('bell.wav'); // buffers automatically when created
@ -55,7 +31,6 @@ module.exports = function (Terminal){
Terminal.prototype.write = function (data){
data = fixLinefeed(data);
data = fixIndent(data);
var l = data.length;
var i = 0;