From 42815f72fa97560bc06056b8f1a20943873240d0 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 6 Mar 2013 04:27:42 -0600 Subject: [PATCH] add extended xterm features. --- lib/program.js | 35 +++++++++++++++++++++++++++++++++++ test/tput.js | 2 ++ 2 files changed, 37 insertions(+) diff --git a/lib/program.js b/lib/program.js index a7292e6..d21a84b 100644 --- a/lib/program.js +++ b/lib/program.js @@ -973,6 +973,36 @@ Program.prototype.setTitle = function(title) { return this.osc('0;' + title + '\x07'); }; +// OSC Ps ; Pt ST +// OSC Ps ; Pt BEL +// Reset colors +Program.prototype.resetColors = function(param) { + if (this.tput && this.tput.Cr) { + return this.put.Cr(param); + } + return this.osc('112;' + param + '\x07'); +}; + +// OSC Ps ; Pt ST +// OSC Ps ; Pt BEL +// Change dynamic colors +Program.prototype.dynamicColors = function(param) { + if (this.tput && this.tput.Cs) { + return this.put.Cs(param); + } + return this.osc('12;' + param + '\x07'); +}; + +// OSC Ps ; Pt ST +// OSC Ps ; Pt BEL +// Sel data +Program.prototype.selData = function(a, b) { + if (this.tput && this.tput.Ms) { + return this.put.Ms(a, b); + } + return this.osc('52;' + a + ';' + b + '\x07'); +}; + /** * CSI */ @@ -1062,6 +1092,7 @@ Program.prototype.eraseInDisplay = function(param) { param = 0; break; } + // extended tput.E3 = ^[[3;J return this.put.ed(param); } switch (param) { @@ -2264,6 +2295,10 @@ Program.prototype.setCursorStyle = function(param) { param = '6'; break; } + // extended tput.Se for param=2 + if (this.tput && this.tput.Ss) { + return this.put.Ss(param); + } return this.write('\x1b[' + (param || 1) + ' q'); }; diff --git a/test/tput.js b/test/tput.js index f04a005..9ba1f4e 100644 --- a/test/tput.js +++ b/test/tput.js @@ -12,10 +12,12 @@ // $ tic -a -1 usr/xterm.terminfo // $ tic -a -1 usr/xterm.terminfo && ls ~/.terminfo // $ tic -a -1 -o usr usr/xterm.terminfo && mv usr/x/xterm usr/ && rm -rf usr/v usr/x +// $ tic -a -1 -o usr usr/xterm.terminfo && mv usr/x/xterm-256color usr/ && rm -rf usr/v usr/x // Check tput output: // $ node test/tput.js xterm | tee out // $ node test/tput.js xterm --ifile usr/xterm | tee out +// $ node test/tput.js xterm-256color --ifile usr/xterm-256color | tee out // $ node test/tput.js vt102 --termcap | tee out // $ node test/tput.js xterm --termcap --cfile usr/xterm.termcap | tee out // $ node test/tput.js xterm --iprefix ~/.terminfo | tee out