tAdd help for screen UI - sacc - sacc(omys), simple console gopher client (mirror) HTML git clone https://git.parazyd.org/sacc DIR Log DIR Files DIR Refs DIR LICENSE --- DIR commit 54e52d947c665dd719db5e221c184753e192549e DIR parent 7920c2413077be6b62cd0f0510ea5a71a5410aa5 HTML Author: Quentin Rameau <quinq@fifth.space> Date: Thu, 13 Jul 2017 19:52:18 +0200 Add help for screen UI Diffstat: M ui_ti.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) --- DIR diff --git a/ui_ti.c b/ui_ti.c t@@ -7,6 +7,9 @@ #include "common.h" +#define C(c) #c +#define S(c) C(c) + static struct termios tsave; static struct termios tsacc; /* navigation keys */ t@@ -85,10 +88,27 @@ printitem(Item *item) printf("%s %s\r", typedisplay(item->type), item->username); } -static void -help(void) +static Item * +help(Item *entry) { - return; + static Item item = { + .type = '0', + .raw = "Commands:\n" + "Down, " S(_key_lndown) ": move one line down.\n" + "Up, " S(_key_lnup) ": move one line up.\n" + "PgDown, " S(_key_pgdown) ": move one page down.\n" + "PgUp, " S(_key_pgup) ": move one page up.\n" + "Home, " S(_key_home) ": move to top of the page.\n" + "End, " S(_key_end) ": move to end of the page.\n" + "Right, " S(_key_pgnext) ": view highlighted item.\n" + "Left, " S(_key_pgprev) ": view previous item.\n" + S(_key_help) ": show this help.\n" + "^D, " S(_key_quit) ": exit sacc.\n" + }; + + item.entry = entry; + + return &item; } static void t@@ -336,7 +356,7 @@ selectitem(Item *entry) continue; return entry; case _key_help: /* FALLTHROUGH */ - help(); + return help(entry); default: continue; }