js/lex.js: default to {bg,fg} when encoding to mIRC.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2018-10-24 19:04:37 +02:00
parent 21526e2421
commit 44e4b02068

View File

@ -54,9 +54,6 @@ Lex.prototype.mirc = function(){
if ((lastBg == this.fg) && (lastFg == this.bg)) { if ((lastBg == this.fg) && (lastFg == this.bg)) {
lastBg = this.bg; lastFg = this.fg lastBg = this.bg; lastFg = this.fg
return "\x16" + char return "\x16" + char
} else if ((lastBg != this.bg) && (lastFg != this.fg)) {
lastBg = this.bg; lastFg = this.fg
return "\x03" + (this.fg&15) + "," + ((this.bg&15) < 10 && !charIsNaN ? "0" : "") + (this.bg&15) + char
} else if ((lastBg != this.bg) && (lastFg == this.fg)) { } else if ((lastBg != this.bg) && (lastFg == this.fg)) {
lastBg = this.bg lastBg = this.bg
return "\x03," + ((this.bg&15) < 10 && !charIsNaN ? "0" : "") + (this.bg&15) + char return "\x03," + ((this.bg&15) < 10 && !charIsNaN ? "0" : "") + (this.bg&15) + char
@ -64,7 +61,8 @@ Lex.prototype.mirc = function(){
lastFg = this.fg lastFg = this.fg
return "\x03" + ((this.fg&15) < 10 && !charIsNaN ? "0" : "") + (this.fg&15) + char return "\x03" + ((this.fg&15) < 10 && !charIsNaN ? "0" : "") + (this.fg&15) + char
} else { } else {
return "\x03" + "0,1" lastBg = this.bg; lastFg = this.fg
return "\x03" + (this.fg&15) + "," + ((this.bg&15) < 10 && !charIsNaN ? "0" : "") + (this.bg&15) + char
} }
} }
Lex.prototype.ansi = function(){ Lex.prototype.ansi = function(){