diff --git a/core/ansi_escape_parser.js b/core/ansi_escape_parser.js index 756ffbef..b8c62342 100644 --- a/core/ansi_escape_parser.js +++ b/core/ansi_escape_parser.js @@ -29,11 +29,6 @@ function ANSIEscapeParser(options) { this.termHeight = miscUtil.valueWithDefault(options.termHeight, 25); this.termWidth = miscUtil.valueWithDefault(options.termWidth, 80); - function saveLastColor() { - self.lastFlags = self.flags; - self.lastFgCololr = self.fgColor; - self.lastBgColor = self.bgColor; - } function getArgArray(array) { var i = array.length; @@ -128,7 +123,7 @@ function ANSIEscapeParser(options) { function getProcessedMCI(mci) { if(self.mciReplaceChar.length > 0) { - var eraseColor = ansi.sgr(self.lastFlags, self.lastFgColor, self.lastBgColor); + var eraseColor = ansi.sgr(self.eraseColor.flags, self.eraseColor.fgColor, self.eraseColor.bgColor); return eraseColor + new Array(mci.length + 1).join(self.mciReplaceChar); } else { return mci; @@ -161,12 +156,24 @@ function ANSIEscapeParser(options) { args = []; } + // if MCI codes are changing, save off the current color + var fullMciCode = mciCode + (id || ''); + if(self.lastMciCode !== fullMciCode) { + + self.lastMciCode = fullMciCode; + + self.eraseColor = { + flags : self.flags, + fgColor : self.fgColor, + bgColor : self.bgColor, + }; + } + self.emit('mci', mciCode, id, args); if(self.mciReplaceChar.length > 0) { - escape('m', [self.lastFlags, self.lastFgColor, self.lastBgColor]); - self.emit('chunk', ansi.sgr(self.lastFlags, self.lastFgColor, self.lastBgColor)); + self.emit('chunk', ansi.sgr(self.eraseColor.flags, self.eraseColor.fgColor, self.eraseColor.bgColor)); literal(new Array(match[0].length + 1).join(self.mciReplaceChar)); } else { literal(match[0]); @@ -270,8 +277,6 @@ function ANSIEscapeParser(options) { // set graphic rendition case 'm' : - saveLastColor(); - for(i = 0, len = args.length; i < len; ++i) { arg = args[i]; /*if(0x00 === arg) { @@ -292,7 +297,7 @@ function ANSIEscapeParser(options) { } else if(arg >= 40 && arg <= 47) { self.bgColor = arg; } else { - self.flags = arg; + self.flags |= arg; if(0 === arg) { self.resetColor(); } @@ -310,8 +315,7 @@ function ANSIEscapeParser(options) { } } - this.resetColor(); - saveLastColor(); + this.resetColor(); } util.inherits(ANSIEscapeParser, events.EventEmitter); \ No newline at end of file diff --git a/core/ansi_term.js b/core/ansi_term.js index a135b023..bc4a5a61 100644 --- a/core/ansi_term.js +++ b/core/ansi_term.js @@ -51,8 +51,8 @@ var CONTROL = { goto : 'H', // row Pr, column Pc -- same as f gotoAlt : 'f', // same as H - blinkToBrightIntensity : '33h', - blinkNormal : '33l', + blinkToBrightIntensity : '?33h', + blinkNormal : '?33l', emulationSpeed : '*r' // Set output emulation speed. See cterm.txt }; diff --git a/core/art.js b/core/art.js index c429c1da..c3bd56c3 100644 --- a/core/art.js +++ b/core/art.js @@ -420,7 +420,7 @@ function display(options, cb) { parser.removeAllListeners(); // :TODO: Necessary??? if(iceColors) { - options.client.term.write(ansi.blinkNormal()); + // options.client.term.write(ansi.blinkNormal()); } cb(null, mci); diff --git a/core/logger.js b/core/logger.js index a9c35e18..3effe204 100644 --- a/core/logger.js +++ b/core/logger.js @@ -1,4 +1,5 @@ -"use strict"; +/* jslint node: true */ +'use strict'; var bunyan = require('bunyan'); var miscUtil = require('./misc_util.js'); @@ -6,8 +7,6 @@ var paths = require('path'); var conf = require('./config.js'); module.exports = { - log : undefined, - init : function() { //var ringBufferLimit = miscUtil.valueWithDefault(config.logRingBufferLimit, 100); var logPath = miscUtil.valueWithDefault(conf.config.paths.logs); diff --git a/core/theme.js b/core/theme.js index baf839f6..434d63ac 100644 --- a/core/theme.js +++ b/core/theme.js @@ -4,6 +4,7 @@ var Config = require('./config.js').config; var art = require('./art.js'); var miscUtil = require('./misc_util.js'); +var logger = require('./logger.js').log; var fs = require('fs'); var paths = require('path'); var async = require('async'); @@ -55,6 +56,7 @@ function initAvailableThemes(cb) { availableThemes = {}; } availableThemes[themeId] = info; + logger.debug( { info : info }, 'Theme loaded'); } }); }); @@ -123,7 +125,6 @@ function displayThemeArt(name, client, cb) { } } - console.log(artInfo.sauce.flags); art.display( { art : artInfo.data, client : client, iceColors : iceColors }, function onDisplayed(err, mci) { cb(err, mci); }); diff --git a/mods/art/themes/NU-MAYA/MATRIX.ANS b/mods/art/themes/NU-MAYA/MATRIX.ANS index 06030005..975ce4bb 100644 Binary files a/mods/art/themes/NU-MAYA/MATRIX.ANS and b/mods/art/themes/NU-MAYA/MATRIX.ANS differ