diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-01-30 19:17:33 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-01-30 19:17:33 +0100 |
commit | 718d175591dc4f135dc0bbbb79d5c4ae242a14be (patch) | |
tree | b4d191375d1d975b13bdab9b9c7064f98051dcfb /fbcon.c | |
parent | 5a77b52b4d862cd366cba06145e34349fdbdf6ce (diff) | |
download | fbida-718d175591dc4f135dc0bbbb79d5c4ae242a14be.tar.gz |
cursor key support
Diffstat (limited to 'fbcon.c')
-rw-r--r-- | fbcon.c | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -180,6 +180,15 @@ struct color *tmt_background(struct TMTATTRS *a) /* ---------------------------------------------------------------------- */ +const char *ansiseq[KEY_MAX] = { + [ KEY_UP ] = "\x1b[A", + [ KEY_DOWN ] = "\x1b[B", + [ KEY_RIGHT ] = "\x1b[C", + [ KEY_LEFT ] = "\x1b[D", +}; + +/* ---------------------------------------------------------------------- */ + static void render(void) { static bool second; @@ -373,10 +382,15 @@ int main(int argc, char *argv[]) down = libinput_event_keyboard_get_key_state(kevt); xkb_state_update_key(state, key, down); if (down) { - rc = xkb_state_key_get_utf8(state, key, - buf, sizeof(buf)); - if (rc > 0) - write(pty, buf, rc); + if (ansiseq[key - 8]) { + write(pty, ansiseq[key - 8], + strlen(ansiseq[key - 8])); + } else { + rc = xkb_state_key_get_utf8(state, key, + buf, sizeof(buf)); + if (rc > 0) + write(pty, buf, rc); + } } break; default: |