From b42308c7cc3e544821254a0095082d22b60f5af9 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 22 Feb 2015 13:35:49 -0800 Subject: [PATCH] fix key events for textareas. --- lib/widget.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index 42e96fa..b5d9b12 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -5122,8 +5122,12 @@ Textarea.prototype.readInput = function(callback) { : callback(null, value); }; - this.__listener = this._listener.bind(this); - this.on('keypress', this.__listener); + // Put this in a nextTick so the current + // key event doesn't trigger any keys input. + nextTick(function() { + self.__listener = self._listener.bind(self); + self.on('keypress', self.__listener); + }); this.__done = this._done.bind(this, null, null); this.on('blur', this.__done);