mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-08 04:04:04 +08:00
update files
This commit is contained in:
parent
e90d05c1bc
commit
abaea8ed18
@ -121,17 +121,17 @@ module.exports = function (Terminal){
|
|||||||
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '&':
|
case '&':
|
||||||
out += '&';
|
out += '&';
|
||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
out += '<';
|
out += '<';
|
||||||
break;
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
out += '>';
|
out += '>';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (ch <= ' ') {
|
if (ch <= ' ') {
|
||||||
out += ' ';
|
out += '>';
|
||||||
} else {
|
} else {
|
||||||
if (this.isWide(ch)) i++;
|
if (this.isWide(ch)) i++;
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ module.exports = function (Terminal){
|
|||||||
this.lines = this.lines.slice(-(this.ybase + this.rows) + 1);
|
this.lines = this.lines.slice(-(this.ybase + this.rows) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(this.ybase, this.scrollback);
|
||||||
|
|
||||||
this.ydisp = this.ybase;
|
this.ydisp = this.ybase;
|
||||||
|
|
||||||
// last line
|
// last line
|
||||||
|
@ -10,30 +10,6 @@ function fixLinefeed(data){
|
|||||||
return data.replace(/([^\r])\n/g, '$1\r\n');
|
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 = ' ' + line;
|
|
||||||
}
|
|
||||||
|
|
||||||
return line;
|
|
||||||
})
|
|
||||||
.join('\r\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (Terminal){
|
module.exports = function (Terminal){
|
||||||
Terminal.prototype.bell = function (){
|
Terminal.prototype.bell = function (){
|
||||||
var snd = new Audio('bell.wav'); // buffers automatically when created
|
var snd = new Audio('bell.wav'); // buffers automatically when created
|
||||||
@ -55,7 +31,6 @@ module.exports = function (Terminal){
|
|||||||
|
|
||||||
Terminal.prototype.write = function (data){
|
Terminal.prototype.write = function (data){
|
||||||
data = fixLinefeed(data);
|
data = fixLinefeed(data);
|
||||||
data = fixIndent(data);
|
|
||||||
|
|
||||||
var l = data.length;
|
var l = data.length;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user