window title. potential enter/return fix for keys.

This commit is contained in:
Christopher Jeffrey 2015-01-29 20:08:23 -08:00
parent 0881128a4f
commit 547812928e
3 changed files with 21 additions and 9 deletions

View File

@ -126,6 +126,8 @@ function emitKey(stream, s) {
} else if (s === '\n') {
// enter, should have been called linefeed
key.name = 'enter';
// linefeed
// key.name = 'linefeed';
} else if (s === '\t') {
// tab
@ -298,5 +300,13 @@ function emitKey(stream, s) {
if (key || ch) {
stream.emit('keypress', ch, key);
// if (key && key.name === 'return') {
// var nkey = {};
// Object.keys(key).forEach(function(k) {
// nkey[k] = key[k];
// });
// nkey.name = 'enter';
// stream.emit('keypress', ch, nkey);
// }
}
}

View File

@ -1387,6 +1387,15 @@ Program.prototype.repeat = function(ch, i) {
return Array(i + 1).join(ch);
};
Program.prototype.__defineGetter__('title', function() {
return this._title;
});
Program.prototype.__defineSetter__('title', function(title) {
this.setTitle(title);
return this._title;
});
/**
* Normal
*/
@ -1721,14 +1730,6 @@ Program.prototype.setTitle = function(title) {
return this._write('\x1b]0;' + title + '\x07');
};
Program.prototype.__defineGetter__('title', function() {
return this._title;
});
Program.prototype.__defineSetter__('title', function(title) {
return this.setTitle(title);
});
// OSC Ps ; Pt ST
// OSC Ps ; Pt BEL
// Reset colors

View File

@ -2,7 +2,8 @@ var blessed = require('../')
, screen;
screen = blessed.screen({
dump: __dirname + '/logs/widget.log'
dump: __dirname + '/logs/widget.log',
title: 'widget test'
});
screen.append(blessed.text({