Define keybindings at the start of ui_ti.c - sacc - sacc(omys), simple console gopher client HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/ DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit 1f6a07a9ac37cb70cc30ef54684c92baae51fb71 DIR parent 641ce728054743d3f0475ba6c35bafb6d2bc10ac HTML Author: Quentin Rameau <quinq@fifth.space> Date: Mon, 3 Jul 2017 01:05:09 +0200 Define keybindings at the start of ui_ti.c Diffstat: M ui_ti.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) --- DIR diff --git a/ui_ti.c b/ui_ti.c @@ -7,6 +7,14 @@ #include "common.h" static struct termios tsave; +/* navigation keys */ +#define ui_lndown 'j' /* move one line down */ +#define ui_lnup 'k' /* move one line up */ +#define ui_pgnext 'l' /* view highlighted item */ +#define ui_pgprev 'h' /* view previous item */ +#define ui_fetch 'L' /* refetch current item */ +#define ui_help '?' /* display help */ +#define ui_quit 'q' /* exit sacc */ void uisetup(void) @@ -140,25 +148,25 @@ selectitem(Item *entry) for (;;) { switch (c = getchar()) { - case 'b': + case ui_pgprev: return entry->entry; - case 'g': + case ui_pgnext: if (entry->dir->items[entry->curline]->type < '2') return entry->dir->items[entry->curline]; continue; - case 'n': + case ui_lndown: movecurline(entry, 1); continue; - case 'p': + case ui_lnup: movecurline(entry, -1); continue; - case 'q': + case ui_quit: return NULL; - case '!': + case ui_fetch: if (entry->raw) continue; return entry; - case 'h': /* FALLTHROUGH */ + case ui_help: /* FALLTHROUGH */ help(); default: continue;