From 9bffe0da811c4ff445348531f66db1559d80fd2d Mon Sep 17 00:00:00 2001 From: Florrie Date: Wed, 12 Sep 2018 14:09:46 -0300 Subject: Add 'cancel' event (on ESC) to TextInput --- ui/form/TextInput.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ui') 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 => { -- cgit 1.3.0-6-gf8a5