mirror of
https://github.com/nuintun/command-manager.git
synced 2025-12-18 17:04:23 +08:00
update files
This commit is contained in:
@@ -16,20 +16,22 @@ module.exports = function (Terminal){
|
||||
// Next 14 bits: a mask for misc.
|
||||
// flags: 1=bold, 2=underline, 4=blink, 8=inverse, 16=invisible
|
||||
|
||||
function screen(foreground, background, content){
|
||||
var intro = '<div class="ui-terminal" tabindex="0" spellcheck="false" '
|
||||
+ 'style="outline:none;background-color:' + background + ' ; color:' + foreground + ';">';
|
||||
var outro = '</div>';
|
||||
|
||||
return intro + content + outro;
|
||||
}
|
||||
|
||||
/**
|
||||
* refresh
|
||||
* @param start
|
||||
* @param end
|
||||
*/
|
||||
Terminal.prototype.refresh = function (start, end){
|
||||
var parent = this.element ? this.element.parentNode : null;
|
||||
var optimize = parent && end - start >= this.rows / 2;
|
||||
var x, y, i, line, out, ch, width, data, attr, fgColor, bgColor, flags, row;
|
||||
|
||||
if (optimize) {
|
||||
parent.removeChild(this.element);
|
||||
}
|
||||
|
||||
width = this.cols;
|
||||
y = start;
|
||||
|
||||
@@ -150,11 +152,9 @@ module.exports = function (Terminal){
|
||||
out += '</span>';
|
||||
}
|
||||
|
||||
this.children[y].innerHTML = out;
|
||||
this.screenLines[y] = '<div>' + out + '</div>';
|
||||
}
|
||||
|
||||
if (optimize) {
|
||||
parent.appendChild(this.element);
|
||||
}
|
||||
this.screen = screen(this.fgColor, this.bgColor, this.screenLines.join(''));
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user