« get me outta code hell

A long-due cleanup + examples + things - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/telchars.js
diff options
context:
space:
mode:
authorliam4 <towerofnix@gmail.com>2017-07-03 18:59:57 -0300
committerliam4 <towerofnix@gmail.com>2017-07-03 19:00:01 -0300
commit769413468e88acba1a180baa0113139d929a3b9f (patch)
treef29af36826077178259b7bcc8bf9927cebfe71e3 /telchars.js
parent489e4d0c78d5f393729cda0e1f6ac9a0a1237b4a (diff)
A long-due cleanup + examples + things
..Obviously this breaks old things (particularly, see changes in
FocusElement).
Diffstat (limited to 'telchars.js')
-rw-r--r--telchars.js30
1 files changed, 0 insertions, 30 deletions
diff --git a/telchars.js b/telchars.js
deleted file mode 100644
index 8cf414c..0000000
--- a/telchars.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// Useful telnet key detection.
-
-const telchars = {
-  isSpace: buf => buf[0] === 0x20,
-  isEnter: buf => buf[0] === 0x0d && buf[1] === 0x00,
-  isTab: buf => buf[0] === 0x09,
-  isBackTab: buf => buf[0] === 0x1b && buf[2] === 0x5A,
-
-  // isEscape is hard because it's just send as ESC (the ANSI escape code),
-  // so we need to make sure that the escape code is all on its own
-  // (i.e. the length is 1)
-  isEscape: buf => buf[0] === 0x1b && buf.length === 1,
-
-  // Use this for when you'd like to detect the user confirming or issuing a
-  // command, like the X button on your PlayStation controller, or the mouse
-  // when you click on a button.
-  isSelect: buf => telchars.isSpace(buf) || telchars.isEnter(buf),
-
-  // Use this for when you'd like to detect the user cancelling an action,
-  // like the O button on your PlayStation controller, or the Escape key on
-  // your keyboard.
-  isCancel: buf => telchars.isEscape(buf),
-
-  isUp: buf => buf[0] === 0x1b && buf[2] === 0x41,
-  isDown: buf => buf[0] === 0x1b && buf[2] === 0x42,
-  isRight: buf => buf[0] === 0x1b && buf[2] === 0x43,
-  isLeft: buf => buf[0] === 0x1b && buf[2] === 0x44,
-}
-
-module.exports = telchars