diff options
author | P. J. McDermott <pj@pehjota.net> | 2015-10-29 01:20:05 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2015-10-29 01:20:05 (EDT) |
commit | 9d7e7f9d2db1be37c21bb928c87eba1082604ab5 (patch) | |
tree | a8e5d954ead788a11f314e8612c919eace44317e | |
parent | edf31ad035431febc2f0a55271642d7365600c57 (diff) | |
download | firman.sh-9d7e7f9d2db1be37c21bb928c87eba1082604ab5.zip firman.sh-9d7e7f9d2db1be37c21bb928c87eba1082604ab5.tar.gz firman.sh-9d7e7f9d2db1be37c21bb928c87eba1082604ab5.tar.bz2 |
term_getch(): Handle KEY_HOME and KEY_END
-rw-r--r-- | src/term.sh | 31 |
1 files changed, 19 insertions, 12 deletions
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;; |