« get me outta code hell

tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui/form/TextInput.js3
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
         }