summaryrefslogtreecommitdiff
path: root/js/matrix.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-11-21 19:56:44 -0500
committerJules Laplace <jules@okfoc.us>2016-11-21 19:56:44 -0500
commitda41cc8faa8e38fedf26e1c4c711bd00cef92482 (patch)
tree30f8779177532acb96f2d5d7a82def1e0e5d8d1a /js/matrix.js
parent9043d36f00094c94f45fb24057886d943463bef9 (diff)
exporting escape codes
Diffstat (limited to 'js/matrix.js')
-rw-r--r--js/matrix.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/matrix.js b/js/matrix.js
index 1aeb929..dbc76c7 100644
--- a/js/matrix.js
+++ b/js/matrix.js
@@ -250,6 +250,23 @@ Matrix.prototype.ascii = function () {
var txt = lines.join("\n")
return txt
}
+Matrix.prototype.ansi = function (opts) {
+ var lines = this.aa.map(function(row, y){
+ var last, line = ""
+ row.forEach(function(lex, x) {
+ if (lex.eqColor(last)) {
+ line += lex.sanitize()
+ }
+ else {
+ line += lex.ansi()
+ last = lex
+ }
+ })
+ return line
+ })
+ var txt = lines.filter(function(line){ return line.length > 0 }).join('\\e[0m\\n') + "\\e[0m"
+ return 'echo -e "' + txt + '"'
+}
Matrix.prototype.mirc = function (opts) {
var cutoff = false
var lines = this.aa.map(function(row, y){