xterm-addon-serialize
Advanced tools
Comparing version 0.3.0 to 0.4.0-beta.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SerializeAddon=t():e.SerializeAddon=t()}(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.SerializeAddon=void 0;var o=function(e){function t(t){var i=e.call(this,t)||this;return i._rowIndex=0,i._allRows=new Array,i._currentRow="",i._nullCellCount=0,i}return r(t,e),t.prototype._beforeSerialize=function(e){this._allRows=new Array(e)},t.prototype._rowEnd=function(e){this._allRows[this._rowIndex++]=this._currentRow,this._currentRow="",this._nullCellCount=0},t.prototype._nextCell=function(e,t,i,n){var r,o,l=[],s=(o=t,!((r=e).getFgColorMode()===o.getFgColorMode()&&r.getFgColor()===o.getFgColor())),u=!function(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}(e,t),f=!function(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()}(e,t);if(s||u||f)if(e.isAttributeDefault())this._currentRow+="[0m";else{if(s){var a=e.getFgColor();e.isFgRGB()?l.push(38,2,a>>>16&255,a>>>8&255,255&a):e.isFgPalette()?a>=16?l.push(38,5,a):l.push(8&a?90+(7&a):30+(7&a)):l.push(39)}if(u){a=e.getBgColor();e.isBgRGB()?l.push(48,2,a>>>16&255,a>>>8&255,255&a):e.isBgPalette()?a>=16?l.push(48,5,a):l.push(8&a?100+(7&a):40+(7&a)):l.push(49)}f&&(e.isInverse()!==t.isInverse()&&l.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&l.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&l.push(e.isUnderline()?4:24),e.isBlink()!==t.isBlink()&&l.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&l.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&l.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&l.push(e.isDim()?2:22))}l.length&&(this._currentRow+="["+l.join(";")+"m"),""===e.getChars()?this._nullCellCount++:this._nullCellCount>0&&(this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._currentRow+=e.getChars()},t.prototype._serializeString=function(){for(var e=this._allRows.length;e>0&&!this._allRows[e-1];e--);return this._allRows.slice(0,e).join("\r\n")},t}(function(){function e(e){this._buffer=e}return e.prototype.serialize=function(e,t){var i=this._buffer.getNullCell(),n=this._buffer.getNullCell(),r=i;this._beforeSerialize(t-e);for(var o=e;o<t;o++){var l=this._buffer.getLine(o);if(l)for(var s=0;s<l.length;s++){var u=l.getCell(s,r===i?n:i);u?(this._nextCell(u,r,o,s),r=u):console.warn("Can't get cell at row="+o+", col="+s)}this._rowEnd(o)}return this._afterSerialize(),this._serializeString()},e.prototype._nextCell=function(e,t,i,n){},e.prototype._rowEnd=function(e){},e.prototype._beforeSerialize=function(e){},e.prototype._afterSerialize=function(){},e.prototype._serializeString=function(){return""},e}()),l=function(){function e(){}return e.prototype.activate=function(e){this._terminal=e},e.prototype.serialize=function(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");var t,i,n,r=this._terminal.buffer.active.length,l=new o(this._terminal.buffer.active);return e=void 0===e?r:(t=e,i=0,n=r,Math.max(i,Math.min(t,n))),l.serialize(r-e,r)},e.prototype.dispose=function(){},e}();t.SerializeAddon=l}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SerializeAddon=t():e.SerializeAddon=t()}(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.SerializeAddon=void 0;var o=function(e){function t(t){var i=e.call(this,t)||this;return i._rowIndex=0,i._allRows=new Array,i._currentRow="",i._nullCellCount=0,i}return r(t,e),t.prototype._beforeSerialize=function(e){this._allRows=new Array(e)},t.prototype._rowEnd=function(e){this._allRows[this._rowIndex++]=this._currentRow,this._currentRow="",this._nullCellCount=0},t.prototype._nextCell=function(e,t,i,n){var r,o,l=[],s=(o=t,!((r=e).getFgColorMode()===o.getFgColorMode()&&r.getFgColor()===o.getFgColor())),u=!function(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}(e,t),a=!function(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()}(e,t);if(s||u||a)if(e.isAttributeDefault())this._currentRow+="[0m";else{if(s){var f=e.getFgColor();e.isFgRGB()?l.push(38,2,f>>>16&255,f>>>8&255,255&f):e.isFgPalette()?f>=16?l.push(38,5,f):l.push(8&f?90+(7&f):30+(7&f)):l.push(39)}if(u){f=e.getBgColor();e.isBgRGB()?l.push(48,2,f>>>16&255,f>>>8&255,255&f):e.isBgPalette()?f>=16?l.push(48,5,f):l.push(8&f?100+(7&f):40+(7&f)):l.push(49)}a&&(e.isInverse()!==t.isInverse()&&l.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&l.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&l.push(e.isUnderline()?4:24),e.isBlink()!==t.isBlink()&&l.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&l.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&l.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&l.push(e.isDim()?2:22))}l.length&&(this._currentRow+="["+l.join(";")+"m"),""===e.getChars()?this._nullCellCount+=e.getWidth():this._nullCellCount>0&&(this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._currentRow+=e.getChars()},t.prototype._serializeString=function(){for(var e=this._allRows.length;e>0&&!this._allRows[e-1];e--);return this._allRows.slice(0,e).join("\r\n")},t}(function(){function e(e){this._buffer=e}return e.prototype.serialize=function(e,t){var i=this._buffer.getNullCell(),n=this._buffer.getNullCell(),r=i;this._beforeSerialize(t-e);for(var o=e;o<t;o++){var l=this._buffer.getLine(o);if(l)for(var s=0;s<l.length;s++){var u=l.getCell(s,r===i?n:i);u?(this._nextCell(u,r,o,s),r=u):console.warn("Can't get cell at row="+o+", col="+s)}this._rowEnd(o)}return this._afterSerialize(),this._serializeString()},e.prototype._nextCell=function(e,t,i,n){},e.prototype._rowEnd=function(e){},e.prototype._beforeSerialize=function(e){},e.prototype._afterSerialize=function(){},e.prototype._serializeString=function(){return""},e}()),l=function(){function e(){}return e.prototype.activate=function(e){this._terminal=e},e.prototype.serialize=function(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");var t,i,n,r=this._terminal.buffer.active.length,l=new o(this._terminal.buffer.active);return e=void 0===e?r:(t=e,i=0,n=r,Math.max(i,Math.min(t,n))),l.serialize(r-e,r)},e.prototype.dispose=function(){},e}();t.SerializeAddon=l}])})); | ||
//# sourceMappingURL=xterm-addon-serialize.js.map |
@@ -156,3 +156,3 @@ "use strict"; | ||
if (cell.getChars() === '') { | ||
this._nullCellCount++; | ||
this._nullCellCount += cell.getWidth(); | ||
} | ||
@@ -159,0 +159,0 @@ else if (this._nullCellCount > 0) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -163,3 +163,3 @@ }; | ||
if (cell.getChars() === '') { | ||
this._nullCellCount++; | ||
this._nullCellCount += cell.getWidth(); | ||
} | ||
@@ -166,0 +166,0 @@ else if (this._nullCellCount > 0) { |
{ | ||
"name": "xterm-addon-serialize", | ||
"version": "0.3.0", | ||
"version": "0.4.0-beta.1", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "The xterm.js authors", |
@@ -141,3 +141,3 @@ /** | ||
if (cell.getChars() === '') { | ||
this._nullCellCount++; | ||
this._nullCellCount += cell.getWidth(); | ||
} else if (this._nullCellCount > 0) { | ||
@@ -144,0 +144,0 @@ this._currentRow += `\x1b[${this._nullCellCount}C`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72946