xterm-addon-serialize
Advanced tools
Comparing version 0.6.0 to 0.7.0-beta.1
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SerializeAddon=e():t.SerializeAddon=e()}(this,(function(){return(()=>{"use strict";var t={};return{44:function(t,e){var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});function o(t,e){return t.getBgColorMode()===e.getBgColorMode()&&t.getBgColor()===e.getBgColor()}Object.defineProperty(e,"__esModule",{value:!0}),e.SerializeAddon=void 0;var s=function(t){function e(e,r){var i=t.call(this,e)||this;return i._terminal=r,i._rowIndex=0,i._allRows=new Array,i._allRowSeparators=new Array,i._currentRow="",i._nullCellCount=0,i._cursorStyle=i._buffer.getNullCell(),i._cursorStyleRow=0,i._cursorStyleCol=0,i._backgroundCell=i._buffer.getNullCell(),i._firstRow=0,i._lastCursorRow=0,i._lastCursorCol=0,i._lastContentCursorRow=0,i._lastContentCursorCol=0,i._thisRowLastChar=i._buffer.getNullCell(),i._thisRowLastSecondChar=i._buffer.getNullCell(),i._nextRowFirstChar=i._buffer.getNullCell(),i}return i(e,t),e.prototype._beforeSerialize=function(t,e,r){this._allRows=new Array(t),this._lastContentCursorRow=e,this._lastCursorRow=e,this._firstRow=e},e.prototype._rowEnd=function(t,e){var r;this._nullCellCount>0&&!o(this._cursorStyle,this._backgroundCell)&&(this._currentRow+="["+this._nullCellCount+"X");var i="";if(!e){t-this._firstRow>=this._terminal.rows&&(null===(r=this._buffer.getLine(this._cursorStyleRow))||void 0===r||r.getCell(this._cursorStyleCol,this._backgroundCell));var s=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(l.isWrapped){i="";var n=s.getCell(s.length-1,this._thisRowLastChar),u=s.getCell(s.length-2,this._thisRowLastSecondChar),a=l.getCell(0,this._nextRowFirstChar),h=a.getWidth()>1,_=!1;(a.getChars()&&h?this._nullCellCount<=1:this._nullCellCount<=0)&&((n.getChars()||0===n.getWidth())&&o(n,a)&&(_=!0),h&&(u.getChars()||0===u.getWidth())&&o(n,a)&&o(u,a)&&(_=!0)),_||(i="-".repeat(this._nullCellCount+1),i+="[1D[1X",this._nullCellCount>0&&(i+="[A",i+="["+(s.length-this._nullCellCount)+"C",i+="["+this._nullCellCount+"X",i+="["+(s.length-this._nullCellCount)+"D",i+="[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}else i="\r\n",this._lastCursorRow=t+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=i,this._currentRow="",this._nullCellCount=0},e.prototype._diffStyle=function(t,e){var r,i,s=[],l=(i=e,!((r=t).getFgColorMode()===i.getFgColorMode()&&r.getFgColor()===i.getFgColor())),n=!o(t,e),u=!function(t,e){return t.isInverse()===e.isInverse()&&t.isBold()===e.isBold()&&t.isUnderline()===e.isUnderline()&&t.isBlink()===e.isBlink()&&t.isInvisible()===e.isInvisible()&&t.isItalic()===e.isItalic()&&t.isDim()===e.isDim()}(t,e);if(l||n||u)if(t.isAttributeDefault())e.isAttributeDefault()||s.push(0);else{if(l){var a=t.getFgColor();t.isFgRGB()?s.push(38,2,a>>>16&255,a>>>8&255,255&a):t.isFgPalette()?a>=16?s.push(38,5,a):s.push(8&a?90+(7&a):30+(7&a)):s.push(39)}n&&(a=t.getBgColor(),t.isBgRGB()?s.push(48,2,a>>>16&255,a>>>8&255,255&a):t.isBgPalette()?a>=16?s.push(48,5,a):s.push(8&a?100+(7&a):40+(7&a)):s.push(49)),u&&(t.isInverse()!==e.isInverse()&&s.push(t.isInverse()?7:27),t.isBold()!==e.isBold()&&s.push(t.isBold()?1:22),t.isUnderline()!==e.isUnderline()&&s.push(t.isUnderline()?4:24),t.isBlink()!==e.isBlink()&&s.push(t.isBlink()?5:25),t.isInvisible()!==e.isInvisible()&&s.push(t.isInvisible()?8:28),t.isItalic()!==e.isItalic()&&s.push(t.isItalic()?3:23),t.isDim()!==e.isDim()&&s.push(t.isDim()?2:22))}return s},e.prototype._nextCell=function(t,e,r,i){if(0!==t.getWidth()){var s=""===t.getChars(),l=this._diffStyle(t,this._cursorStyle);if(s?!o(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+="["+l.join(";")+"m";var n=this._buffer.getLine(r);void 0!==n&&(n.getCell(i,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=i)}s?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}},e.prototype._serializeString=function(){var t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);for(var e="",r=0;r<t;r++)e+=this._allRows[r],r+1<t&&(e+=this._allRowSeparators[r]);var i,o=this._buffer.baseY+this._buffer.cursorY,s=this._buffer.cursorX;return(o!==this._lastCursorRow||s!==this._lastCursorCol)&&((i=o-this._lastCursorRow)>0?e+="["+i+"B":i<0&&(e+="["+-i+"A"),function(t){t>0?e+="["+t+"C":t<0&&(e+="["+-t+"D")}(s-this._lastCursorCol)),e},e}(function(){function t(t){this._buffer=t}return t.prototype.serialize=function(t,e){var r=this._buffer.getNullCell(),i=this._buffer.getNullCell(),o=r;this._beforeSerialize(e-t,t,e);for(var s=t;s<e;s++){var l=this._buffer.getLine(s);if(l)for(var n=0;n<l.length;n++){var u=l.getCell(n,o===r?i:r);u?(this._nextCell(u,o,s,n),o=u):console.warn("Can't get cell at row="+s+", col="+n)}this._rowEnd(s,s===e-1)}return this._afterSerialize(),this._serializeString()},t.prototype._nextCell=function(t,e,r,i){},t.prototype._rowEnd=function(t,e){},t.prototype._beforeSerialize=function(t,e,r){},t.prototype._afterSerialize=function(){},t.prototype._serializeString=function(){return""},t}()),l=function(){function t(){}return t.prototype.activate=function(t){this._terminal=t},t.prototype._serializeBuffer=function(t,e,r){var i,o,l=e.length,n=new s(e,t),u=void 0===r?l:(i=r+t.rows,0,o=l,Math.max(0,Math.min(i,o)));return n.serialize(l-u,l)},t.prototype._serializeModes=function(t){var e="",r=t.modes;if(r.applicationCursorKeysMode&&(e+="[?1h"),r.applicationKeypadMode&&(e+="[?66h"),r.bracketedPasteMode&&(e+="[?2004h"),r.insertMode&&(e+="[4h"),r.originMode&&(e+="[?6h"),r.reverseWraparoundMode&&(e+="[?45h"),r.sendFocusMode&&(e+="[?1004h"),!1===r.wraparoundMode&&(e+="[?7l"),"none"!==r.mouseTrackingMode)switch(r.mouseTrackingMode){case"x10":e+="[?9h";break;case"vt200":e+="[?1000h";break;case"drag":e+="[?1002h";break;case"any":e+="[?1003h"}return e},t.prototype.serialize=function(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");var e=this._serializeBuffer(this._terminal,this._terminal.buffer.normal,t);return"alternate"===this._terminal.buffer.active.type&&(e+="[?1049h[H"+this._serializeBuffer(this._terminal,this._terminal.buffer.alternate,void 0)),e+this._serializeModes(this._terminal)},t.prototype.dispose=function(){},t}();e.SerializeAddon=l}}[44](0,t),t})()})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SerializeAddon=e():t.SerializeAddon=e()}(this,(function(){return(()=>{"use strict";var t={};return{44:function(t,e){var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});function o(t,e){return t.getBgColorMode()===e.getBgColorMode()&&t.getBgColor()===e.getBgColor()}Object.defineProperty(e,"__esModule",{value:!0}),e.SerializeAddon=void 0;var s=function(t){function e(e,r){var i=t.call(this,e)||this;return i._terminal=r,i._rowIndex=0,i._allRows=new Array,i._allRowSeparators=new Array,i._currentRow="",i._nullCellCount=0,i._cursorStyle=i._buffer.getNullCell(),i._cursorStyleRow=0,i._cursorStyleCol=0,i._backgroundCell=i._buffer.getNullCell(),i._firstRow=0,i._lastCursorRow=0,i._lastCursorCol=0,i._lastContentCursorRow=0,i._lastContentCursorCol=0,i._thisRowLastChar=i._buffer.getNullCell(),i._thisRowLastSecondChar=i._buffer.getNullCell(),i._nextRowFirstChar=i._buffer.getNullCell(),i}return i(e,t),e.prototype._beforeSerialize=function(t,e,r){this._allRows=new Array(t),this._lastContentCursorRow=e,this._lastCursorRow=e,this._firstRow=e},e.prototype._rowEnd=function(t,e){var r;this._nullCellCount>0&&!o(this._cursorStyle,this._backgroundCell)&&(this._currentRow+="["+this._nullCellCount+"X");var i="";if(!e){t-this._firstRow>=this._terminal.rows&&(null===(r=this._buffer.getLine(this._cursorStyleRow))||void 0===r||r.getCell(this._cursorStyleCol,this._backgroundCell));var s=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(l.isWrapped){i="";var n=s.getCell(s.length-1,this._thisRowLastChar),u=s.getCell(s.length-2,this._thisRowLastSecondChar),a=l.getCell(0,this._nextRowFirstChar),h=a.getWidth()>1,_=!1;(a.getChars()&&h?this._nullCellCount<=1:this._nullCellCount<=0)&&((n.getChars()||0===n.getWidth())&&o(n,a)&&(_=!0),h&&(u.getChars()||0===u.getWidth())&&o(n,a)&&o(u,a)&&(_=!0)),_||(i="-".repeat(this._nullCellCount+1),i+="[1D[1X",this._nullCellCount>0&&(i+="[A",i+="["+(s.length-this._nullCellCount)+"C",i+="["+this._nullCellCount+"X",i+="["+(s.length-this._nullCellCount)+"D",i+="[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}else i="\r\n",this._lastCursorRow=t+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=i,this._currentRow="",this._nullCellCount=0},e.prototype._diffStyle=function(t,e){var r,i,s=[],l=(i=e,!((r=t).getFgColorMode()===i.getFgColorMode()&&r.getFgColor()===i.getFgColor())),n=!o(t,e),u=!function(t,e){return t.isInverse()===e.isInverse()&&t.isBold()===e.isBold()&&t.isUnderline()===e.isUnderline()&&t.isBlink()===e.isBlink()&&t.isInvisible()===e.isInvisible()&&t.isItalic()===e.isItalic()&&t.isDim()===e.isDim()}(t,e);if(l||n||u)if(t.isAttributeDefault())e.isAttributeDefault()||s.push(0);else{if(l){var a=t.getFgColor();t.isFgRGB()?s.push(38,2,a>>>16&255,a>>>8&255,255&a):t.isFgPalette()?a>=16?s.push(38,5,a):s.push(8&a?90+(7&a):30+(7&a)):s.push(39)}n&&(a=t.getBgColor(),t.isBgRGB()?s.push(48,2,a>>>16&255,a>>>8&255,255&a):t.isBgPalette()?a>=16?s.push(48,5,a):s.push(8&a?100+(7&a):40+(7&a)):s.push(49)),u&&(t.isInverse()!==e.isInverse()&&s.push(t.isInverse()?7:27),t.isBold()!==e.isBold()&&s.push(t.isBold()?1:22),t.isUnderline()!==e.isUnderline()&&s.push(t.isUnderline()?4:24),t.isBlink()!==e.isBlink()&&s.push(t.isBlink()?5:25),t.isInvisible()!==e.isInvisible()&&s.push(t.isInvisible()?8:28),t.isItalic()!==e.isItalic()&&s.push(t.isItalic()?3:23),t.isDim()!==e.isDim()&&s.push(t.isDim()?2:22))}return s},e.prototype._nextCell=function(t,e,r,i){if(0!==t.getWidth()){var s=""===t.getChars(),l=this._diffStyle(t,this._cursorStyle);if(s?!o(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+="["+l.join(";")+"m";var n=this._buffer.getLine(r);void 0!==n&&(n.getCell(i,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=i)}s?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}},e.prototype._serializeString=function(){var t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);for(var e="",r=0;r<t;r++)e+=this._allRows[r],r+1<t&&(e+=this._allRowSeparators[r]);var i,o=this._buffer.baseY+this._buffer.cursorY,s=this._buffer.cursorX;return(o!==this._lastCursorRow||s!==this._lastCursorCol)&&((i=o-this._lastCursorRow)>0?e+="["+i+"B":i<0&&(e+="["+-i+"A"),function(t){t>0?e+="["+t+"C":t<0&&(e+="["+-t+"D")}(s-this._lastCursorCol)),e},e}(function(){function t(t){this._buffer=t}return t.prototype.serialize=function(t,e){var r=this._buffer.getNullCell(),i=this._buffer.getNullCell(),o=r;this._beforeSerialize(e-t,t,e);for(var s=t;s<e;s++){var l=this._buffer.getLine(s);if(l)for(var n=0;n<l.length;n++){var u=l.getCell(n,o===r?i:r);u?(this._nextCell(u,o,s,n),o=u):console.warn("Can't get cell at row="+s+", col="+n)}this._rowEnd(s,s===e-1)}return this._afterSerialize(),this._serializeString()},t.prototype._nextCell=function(t,e,r,i){},t.prototype._rowEnd=function(t,e){},t.prototype._beforeSerialize=function(t,e,r){},t.prototype._afterSerialize=function(){},t.prototype._serializeString=function(){return""},t}()),l=function(){function t(){}return t.prototype.activate=function(t){this._terminal=t},t.prototype._serializeBuffer=function(t,e,r){var i,o,l=e.length,n=new s(e,t),u=void 0===r?l:(i=r+t.rows,0,o=l,Math.max(0,Math.min(i,o)));return n.serialize(l-u,l)},t.prototype._serializeModes=function(t){var e="",r=t.modes;if(r.applicationCursorKeysMode&&(e+="[?1h"),r.applicationKeypadMode&&(e+="[?66h"),r.bracketedPasteMode&&(e+="[?2004h"),r.insertMode&&(e+="[4h"),r.originMode&&(e+="[?6h"),r.reverseWraparoundMode&&(e+="[?45h"),r.sendFocusMode&&(e+="[?1004h"),!1===r.wraparoundMode&&(e+="[?7l"),"none"!==r.mouseTrackingMode)switch(r.mouseTrackingMode){case"x10":e+="[?9h";break;case"vt200":e+="[?1000h";break;case"drag":e+="[?1002h";break;case"any":e+="[?1003h"}return e},t.prototype.serialize=function(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");var e=this._serializeBuffer(this._terminal,this._terminal.buffer.normal,null==t?void 0:t.scrollback);return(null==t?void 0:t.excludeAltBuffer)||"alternate"===this._terminal.buffer.active.type&&(e+="[?1049h[H"+this._serializeBuffer(this._terminal,this._terminal.buffer.alternate,void 0)),(null==t?void 0:t.excludeModes)||(e+=this._serializeModes(this._terminal)),e},t.prototype.dispose=function(){},t}();e.SerializeAddon=l}}[44](0,t),t})()})); | ||
//# sourceMappingURL=xterm-addon-serialize.js.map |
@@ -417,3 +417,3 @@ "use strict"; | ||
} | ||
serialize(scrollback) { | ||
serialize(options) { | ||
// TODO: Add combinedData support | ||
@@ -424,10 +424,14 @@ if (!this._terminal) { | ||
// Normal buffer | ||
let content = this._serializeBuffer(this._terminal, this._terminal.buffer.normal, scrollback); | ||
let content = this._serializeBuffer(this._terminal, this._terminal.buffer.normal, options === null || options === void 0 ? void 0 : options.scrollback); | ||
// Alternate buffer | ||
if (this._terminal.buffer.active.type === 'alternate') { | ||
const alternativeScreenContent = this._serializeBuffer(this._terminal, this._terminal.buffer.alternate, undefined); | ||
content += `\u001b[?1049h\u001b[H${alternativeScreenContent}`; | ||
if (!(options === null || options === void 0 ? void 0 : options.excludeAltBuffer)) { | ||
if (this._terminal.buffer.active.type === 'alternate') { | ||
const alternativeScreenContent = this._serializeBuffer(this._terminal, this._terminal.buffer.alternate, undefined); | ||
content += `\u001b[?1049h\u001b[H${alternativeScreenContent}`; | ||
} | ||
} | ||
// Modes | ||
content += this._serializeModes(this._terminal); | ||
if (!(options === null || options === void 0 ? void 0 : options.excludeModes)) { | ||
content += this._serializeModes(this._terminal); | ||
} | ||
return content; | ||
@@ -434,0 +438,0 @@ } |
@@ -370,12 +370,16 @@ "use strict"; | ||
}; | ||
SerializeAddon.prototype.serialize = function (scrollback) { | ||
SerializeAddon.prototype.serialize = function (options) { | ||
if (!this._terminal) { | ||
throw new Error('Cannot use addon until it has been loaded'); | ||
} | ||
var content = this._serializeBuffer(this._terminal, this._terminal.buffer.normal, scrollback); | ||
if (this._terminal.buffer.active.type === 'alternate') { | ||
var alternativeScreenContent = this._serializeBuffer(this._terminal, this._terminal.buffer.alternate, undefined); | ||
content += "\u001B[?1049h\u001B[H" + alternativeScreenContent; | ||
var content = this._serializeBuffer(this._terminal, this._terminal.buffer.normal, options === null || options === void 0 ? void 0 : options.scrollback); | ||
if (!(options === null || options === void 0 ? void 0 : options.excludeAltBuffer)) { | ||
if (this._terminal.buffer.active.type === 'alternate') { | ||
var alternativeScreenContent = this._serializeBuffer(this._terminal, this._terminal.buffer.alternate, undefined); | ||
content += "\u001B[?1049h\u001B[H" + alternativeScreenContent; | ||
} | ||
} | ||
content += this._serializeModes(this._terminal); | ||
if (!(options === null || options === void 0 ? void 0 : options.excludeModes)) { | ||
content += this._serializeModes(this._terminal); | ||
} | ||
return content; | ||
@@ -382,0 +386,0 @@ }; |
{ | ||
"name": "xterm-addon-serialize", | ||
"version": "0.6.0", | ||
"version": "0.7.0-beta.1", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "The xterm.js authors", |
@@ -436,3 +436,3 @@ /** | ||
public serialize(scrollback?: number): string { | ||
public serialize(options?: ISerializeOptions): string { | ||
// TODO: Add combinedData support | ||
@@ -444,12 +444,16 @@ if (!this._terminal) { | ||
// Normal buffer | ||
let content = this._serializeBuffer(this._terminal, this._terminal.buffer.normal, scrollback); | ||
let content = this._serializeBuffer(this._terminal, this._terminal.buffer.normal, options?.scrollback); | ||
// Alternate buffer | ||
if (this._terminal.buffer.active.type === 'alternate') { | ||
const alternativeScreenContent = this._serializeBuffer(this._terminal, this._terminal.buffer.alternate, undefined); | ||
content += `\u001b[?1049h\u001b[H${alternativeScreenContent}`; | ||
if (!options?.excludeAltBuffer) { | ||
if (this._terminal.buffer.active.type === 'alternate') { | ||
const alternativeScreenContent = this._serializeBuffer(this._terminal, this._terminal.buffer.alternate, undefined); | ||
content += `\u001b[?1049h\u001b[H${alternativeScreenContent}`; | ||
} | ||
} | ||
// Modes | ||
content += this._serializeModes(this._terminal); | ||
if (!options?.excludeModes) { | ||
content += this._serializeModes(this._terminal); | ||
} | ||
@@ -461,1 +465,8 @@ return content; | ||
} | ||
interface ISerializeOptions { | ||
scrollback?: number; | ||
excludeModes?: boolean; | ||
excludeAltBuffer?: boolean; | ||
} |
@@ -10,3 +10,3 @@ /** | ||
/** | ||
* An xterm.js addon that enables web links. | ||
* An xterm.js addon that enables serialization of terminal contents. | ||
*/ | ||
@@ -18,3 +18,3 @@ export class SerializeAddon implements ITerminalAddon { | ||
/** | ||
* Activates the addon | ||
* Activates the addon. | ||
* @param terminal The terminal the addon is being loaded in. | ||
@@ -29,7 +29,5 @@ */ | ||
* incomplete frames. | ||
* @param scrollback The number of rows in scrollback buffer to serialize, starting from the | ||
* bottom of the scrollback buffer. This defaults to the all available rows in the scrollback | ||
* buffer. | ||
* @param options Custom options to allow control over what gets serialized. | ||
*/ | ||
public serialize(scrollback?: number): string; | ||
public serialize(options?: ISerializeOptions): string; | ||
@@ -41,2 +39,21 @@ /** | ||
} | ||
export interface ISerializeOptions { | ||
/** | ||
* The number of rows in the scrollback buffer to serialize, starting from the bottom of the | ||
* scrollback buffer. When not specified, all available rows in the scrollback buffer will be | ||
* serialized. | ||
*/ | ||
scrollback?: number; | ||
/** | ||
* Whether to exclude the terminal modes from the serialization. False by default. | ||
*/ | ||
excludeModes?: boolean; | ||
/** | ||
* Whether to exclude the alt buffer from the serialization. False by default. | ||
*/ | ||
excludeAltBuffer?: boolean; | ||
} | ||
} |
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
135282
1447