« 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
path: root/ui/form
diff options
context:
space:
mode:
Diffstat (limited to 'ui/form')
-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 f07b562..766f959 100644
--- a/ui/form/TextInput.js
+++ b/ui/form/TextInput.js
@@ -68,6 +68,9 @@ module.exports = class TextInput extends FocusElement {
       }
     } else if (telc.isEscape(keyBuf)) {
       // ESC is bad and we don't want that in the text input!
+      // Also emit a "cancel" event, which doesn't necessarily do anything,
+      // but can be listened to.
+      this.emit('cancel')
       return
     } else {
       const isTextInput = keyBuf.toString().split('').every(chr => {