From caf3398a3029bc852545ddd5f6584fb9cf3a4929 Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 13 Sep 2018 21:52:18 -0300 Subject: Add TextInput events: confirm (= value), change --- ui/form/TextInput.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/form/TextInput.js b/ui/form/TextInput.js index 5b5fa06..08bbbb6 100644 --- a/ui/form/TextInput.js +++ b/ui/form/TextInput.js @@ -58,7 +58,9 @@ module.exports = class TextInput extends FocusElement { this.root.cursorMoved() return false } else if (keyBuf[0] === 13) { + // These are aliases for each other. this.emit('value', this.value) + this.emit('confirm', this.value) } else if (keyBuf[0] === 0x1b && keyBuf[1] === 0x5b) { // Keyboard navigation if (keyBuf[2] === 0x44) { @@ -87,6 +89,7 @@ module.exports = class TextInput extends FocusElement { ) this.cursorIndex += keyBuf.toString().length this.root.cursorMoved() + this.emit('change', this.value) return false } -- cgit 1.3.0-6-gf8a5