* Fix colors in relation to MCI codes

* iCE colors working, I think...
This commit is contained in:
Bryan Ashby 2014-11-12 23:16:47 -07:00
parent 7bac1b5193
commit 008e9f46d8
6 changed files with 24 additions and 20 deletions

View File

@ -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);

View File

@ -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
};

View File

@ -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);

View File

@ -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);

View File

@ -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);
});

Binary file not shown.