diff options
author | Florrie <towerofnix@gmail.com> | 2018-09-13 21:52:18 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-09-13 21:52:18 -0300 |
commit | caf3398a3029bc852545ddd5f6584fb9cf3a4929 (patch) | |
tree | 574f05451add531f96266b773748cfc2a7aa8adc /ui/form | |
parent | e2f830680c1a6e9f28ad305b105caf5cdf092e63 (diff) |
Add TextInput events: confirm (= value), change
Diffstat (limited to 'ui/form')
-rw-r--r-- | ui/form/TextInput.js | 3 |
1 files changed, 3 insertions, 0 deletions
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 } |