diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-02-10 15:03:39 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-02-10 15:03:39 -0500 |
| commit | cc327f927920ad18e3725e89eefbfa03bba3d5e6 (patch) | |
| tree | d0959f1729b6e1e81f52e6e2af870e5afa9b52c4 /js | |
| parent | 16b05c73a330d1f7519b8c60ddf83844dfd70a9a (diff) | |
fix handling of 0 dollar sign etc
Diffstat (limited to 'js')
| -rw-r--r-- | js/lex.js | 11 | ||||
| -rw-r--r-- | js/matrix.js | 3 |
2 files changed, 10 insertions, 4 deletions
@@ -31,7 +31,12 @@ Lex.prototype.ascii = function(){ return this.char || " " } Lex.prototype.sanitize = function(){ - return this.char == "%" ? '%%' : this.char || " " + switch (this.char) { + case "%": return "%%" + case undefined: + case "": return " " + default: return this.char + } } var fgOnly = false Lex.prototype.mirc = function(){ @@ -42,8 +47,8 @@ Lex.prototype.mirc = function(){ if (fgOnly) { return "\x03" + (this.fg&15) + char } - if (this.bg == 1 && this.fg == 0) { - return char + if ((this.bg&15) < 10) { + return "\x03" + (this.fg&15) + ",0" + (this.bg&15) + char } else { return "\x03" + (this.fg&15) + "," + (this.bg&15) + char diff --git a/js/matrix.js b/js/matrix.js index 79f3d9f..a8ac200 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -170,7 +170,7 @@ Matrix.prototype.mirc = function () { line += lex.sanitize() } else { - if (x > 0 && last && (last.bg != 1 || last.fg != 0)) line += "\x03" + if (x > 0 && last) line += "\x03" line += lex.mirc() last = lex } @@ -187,6 +187,7 @@ Matrix.prototype.irssi = function(){ .replace(/\"/g, '\\\"') .replace(/\'/g, '\\\'') .replace(/\`/g, '\\\`') + .replace(/\$/g, '\\$') .replace(/\s+\n/g, '\n') .replace(/\s+$/g, '\n') .replace(/^\n+/, '') |
