improve window title grabbing.

This commit is contained in:
Christopher Jeffrey 2015-07-21 21:26:40 -07:00
parent 797feb6ab1
commit d64e5f04ff
1 changed files with 25 additions and 6 deletions

View File

@ -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