From eb82bbfef19343a154a77663426292c1e25f06e9 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 3 Jun 2018 19:23:49 -0300 Subject: isPageUp / isPageDown functions, simpler combo detection code --- util/telchars.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'util/telchars.js') diff --git a/util/telchars.js b/util/telchars.js index b39e17b..415eff8 100644 --- a/util/telchars.js +++ b/util/telchars.js @@ -31,10 +31,13 @@ const telchars = { isRight: buf => buf[0] === 0x1b && buf[2] === 0x43, isLeft: buf => buf[0] === 0x1b && buf[2] === 0x44, - isShiftUp: buf => buf[0] === 0x1b && compareBufStr(buf.slice(1), '[1;2A'), - isShiftDown: buf => buf[0] === 0x1b && compareBufStr(buf.slice(1), '[1;2B'), - isShiftRight: buf => buf[0] === 0x1b && compareBufStr(buf.slice(1), '[1;2C'), - isShiftLeft: buf => buf[0] === 0x1b && compareBufStr(buf.slice(1), '[1;2D'), + isShiftUp: buf => compareBufStr(buf, '\x1b[1;2A'), + isShiftDown: buf => compareBufStr(buf, '\x1b[1;2B'), + isShiftRight: buf => compareBufStr(buf, '\x1b[1;2C'), + isShiftLeft: buf => compareBufStr(buf, '\x1b[1;2D'), + + isPageUp: buf => compareBufStr(buf, '\x1b[5~'), + isPageDown: buf => compareBufStr(buf, '\x1b[6~'), isCaselessLetter: (buf, letter) => compareBufStr(buf, letter.toLowerCase()) || compareBufStr(buf, letter.toUpperCase()), } -- cgit 1.3.0-6-gf8a5