From 9d7e7f9d2db1be37c21bb928c87eba1082604ab5 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 29 Oct 2015 01:20:05 -0400 Subject: term_getch(): Handle KEY_HOME and KEY_END --- (limited to 'src') diff --git a/src/term.sh b/src/term.sh index daf2647..f791a7f 100644 --- a/src/term.sh +++ b/src/term.sh @@ -276,14 +276,26 @@ _term_get_escseq() _term_get_byte case "${term_byte}" in - 'A') key=KEY_UP;; - 'B') key=KEY_DOWN;; - 'C') key=KEY_RIGHT;; - 'D') key=KEY_LEFT;; - '3') + '[') _term_get_byte case "${term_byte}" in - '~') key=KEY_DEL;; + 'A') key=KEY_UP;; + 'B') key=KEY_DOWN;; + 'C') key=KEY_RIGHT;; + 'D') key=KEY_LEFT;; + '3') + _term_get_byte + case "${term_byte}" in + '~') key=KEY_DEL;; + esac + ;; + esac + ;; + 'O') + _term_get_byte + case "${term_byte}" in + 'H') key=KEY_HOME;; + 'F') key=KEY_END;; esac ;; esac @@ -299,12 +311,7 @@ term_getch() _term_get_byte case "${term_byte}" in "$(printf '\033')") - _term_get_byte - case "${term_byte}" in - '[') - key="$(_term_get_escseq)" - ;; - esac + key="$(_term_get_escseq)" ;; ' ') key=KEY_SPACE;; "${HT}") key=KEY_TAB;; -- cgit v0.9.1