lib/term_state.js
function TermState(options) {
	TermState.super_.call(this, {
		decodeStrings: false
	});
	options = myUtil.extend({
		attributes: {},
	}, options);
	this._defaultAttr = myUtil.extend({
		fg: null,
		bg: null,
		bold: false,
		underline: false,
		italic: false,
		blink: false,
		inverse: false
	}, options.attributes);

	// This is used for copy on write.
	this._attributesUsed = true;

	this.rows = ~~options.rows || 24;
	this.columns = ~~options.columns || 80;

	this
		.on("newListener", this._newListener)
		.on("removeListener", this._removeListener)
		.on("pipe", this._pipe);
	// Reset all on first use
	this.reset();
}
function TermState(options) {
	TermState.super_.call(this, {
		decodeStrings: false
	});
	options = myUtil.extend({
		attributes: {},
	}, options);
	this._defaultAttr = myUtil.extend({
		fg: null,
		bg: null,
		bold: false,
		underline: false,
		italic: false,
		blink: false,
		inverse: false
	}, options.attributes);

	// This is used for copy on write.
	this._attributesUsed = true;

	this.rows = ~~options.rows || 24;
	this.columns = ~~options.columns || 80;

	this
		.on("newListener", this._newListener)
		.on("removeListener", this._removeListener)
		.on("pipe", this._pipe);
	// Reset all on first use
	this.reset();
}
function TermState ( options ) { TermState . super_ . call ( this , { decodeStrings : false } ) ; options = myUtil . extend ( { attributes : { } , } , options ) ; this . _defaultAttr = myUtil . extend ( { fg : null , bg : null , bold : false , underline : false , italic : false , blink : false , inverse : false } , options . attributes ) ; // This is used for copy on write. this . _attributesUsed = true ; this . rows = ~ ~ options . rows || 24 ; this . columns = ~ ~ options . columns || 80 ; this . on ( "newListener" , this . _newListener ) . on ( "removeListener" , this . _removeListener ) . on ( "pipe" , this . _pipe ) ; // Reset all on first use this . reset ( ) ; }
A class which holds the terminals state and content
@param {object} options - object to configure the terminal
@param {number} [options.columns=80] - number of columns in the terminal
@param {number} [options.rows=24] - number of rows in the terminal
@param {object} [options.attributes] - initial attributes of the terminal
@param {string} [options.attributes.fg=null] initial foreground color
@param {string} [options.attributes.bg=null] initial background color
@param {boolean} [options.attributes.bold=false] terminal is bold by default
@param {boolean} [options.attributes.underline=false] terminal is underlined by default
@param {boolean} [options.attributes.italic=false] terminal is italic by default
@param {boolean} [options.attributes.blink=false] terminal blinks by default
@param {boolean} [options.attributes.inverse=false] terminal has reverse colors by default
@constructor
A class which holds the terminals state and content