diff --git a/lib/program.js b/lib/program.js index 0b28036..9380a8e 100644 --- a/lib/program.js +++ b/lib/program.js @@ -259,9 +259,7 @@ Program.prototype.listen = function() { } if (key.name === 'return' && key.sequence === '\r') { - key.name = 'enter'; - self.input.emit('keypress', ch, key); - key.name = 'return'; + self.input.emit('keypress', ch, merge({}, key, { name: 'enter' })); } var name = (key.ctrl ? 'C-' : '') @@ -3568,6 +3566,15 @@ function unshiftEvent(obj, event, listener) { }); }; +function merge(out) { + slice.call(arguments, 1).forEach(function(obj) { + Object.keys(obj).forEach(function(key) { + out[key] = obj[key]; + }); + }); + return out; +} + /** * Expose */ diff --git a/lib/widget.js b/lib/widget.js index fa4df25..6ace8e9 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -893,7 +893,7 @@ Screen.prototype.draw = function(start, end) { } if (clr && neq) { - lx = ly = -1; + lx = -1, ly = -1; if (data !== attr) { out += this.codeAttr(data); attr = data; @@ -917,7 +917,7 @@ Screen.prototype.draw = function(start, end) { // supports it. Maybe only try to use ECH here. // //if (this.tput && this.tput.strings.erase_chars) // if (!clr && neq && (xx - x) > 10) { - // lx = ly = -1; + // lx = -1, ly = -1; // if (data !== attr) { // out += this.codeAttr(data); // attr = data; @@ -1860,7 +1860,7 @@ function Element(options) { }); this.on('detach', function() { - delete self._lpos; + delete self.lpos; }); if (options.hoverBg != null) {