From d64e5f04ffb972adbb8ad4ac63c7d421007fdd2c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 21 Jul 2015 21:26:40 -0700 Subject: [PATCH] improve window title grabbing. --- lib/program.js | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/program.js b/lib/program.js index c5f4249..ae97fd3 100644 --- a/lib/program.js +++ b/lib/program.js @@ -307,11 +307,14 @@ Program.prototype.term = function(is) { Program.prototype.listen = function() { // Potentially reset window title on exit: - // this.setTitleModeFeature(3); - // this.manipulateWindow(21, function(err, data) { - // if (err) return; - // self._originalTitle = data.text; - // }); + // var self = this; + // if (!this.isRxvt) { + // if (!this.isVTE) this.setTitleModeFeature(3); + // this.manipulateWindow(21, function(err, data) { + // if (err) return; + // self._originalTitle = data.text; + // }); + // } // Listen for keys/mouse on input if (!this.input._blessedListened) { @@ -1332,6 +1335,21 @@ Program.prototype._bindResponse = function(s) { return; } + // rxvt-unicode does not support window manipulation + // Result Normal: OSC l/L 0xEF 0xBF 0xBD + // Result ASCII: OSC l/L 0x1c (file separator) + // Result UTF8->ASCII: OSC l/L 0xFD + // Test with: + // echo -ne '\ePtmux;\e\e[>3t\e\\' + // sleep 2 && echo -ne '\ePtmux;\e\e[21t\e\\' & cat -v + // - + // echo -ne '\e[>3t' + // sleep 2 && echo -ne '\e[21t' & cat -v + if (parts = /^\x1b\](l|L)([^\x07\x1b]*)$/.exec(s)) { + parts[2] = 'rxvt'; + s = '\x1b]' + parts[1] + parts[2] + '\x1b\\'; + } + // CSI Ps ; Ps ; Ps t // Window manipulation (from dtterm, as well as extensions). // These controls may be disabled using the allowWindowOps @@ -3840,8 +3858,9 @@ Program.prototype.reverseAttrInRectangle = function(params) { // Ps = 2 -> Set window/icon labels using UTF-8. // Ps = 3 -> Query window/icon labels using UTF-8. (See dis- // cussion of "Title Modes") +// XXX VTE bizarelly echos this: Program.prototype.setTitleModeFeature = function(params) { - return this._write('\x1b[>' + slice.call(arguments).join(';') + 't'); + return this._twrite('\x1b[>' + slice.call(arguments).join(';') + 't'); }; // CSI Ps SP t