zygo

ncurses gopher client
Log | Files | Refs

commit 67b02509ffd1e833a298cd12643877b7e9773fdd
parent 463e8ebc447c026134aee461775d5d7ee8e1ddd8
Author: hhvn <dev@hhvn.uk>
Date:   Sun, 16 Jan 2022 21:30:28 +0000

zygo.c: + command

Diffstat:
Mzygo.c | 47++++++++++++++++++++++++++++++++++-------------
1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/zygo.c b/zygo.c @@ -645,6 +645,19 @@ run(void) { go(e, 1); elem_free(e); break; + case '+': + if (atoi(ui.arg) >= page->lastid || atoi(ui.arg) < 0) { + error("no suck link: %s", ui.arg); + } else { + move(LINES - 1, 0); + attroff(A_COLOR); + clrtoeol(); + printw("%s", elemtouri(list_idget(&page, atoi(ui.arg)))); + curs_set(0); + candraw = 0; + } + break; + } ui.wantinput = 0; draw_page(); @@ -717,19 +730,6 @@ run(void) { case 'q': endwin(); exit(EXIT_SUCCESS); - /* link numbers */ - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - ui.wantinput = 2; - ui.input[0] = c; - ui.input[1] = '\0'; - syncinput(); - il = 1; - if (digits(page->lastid) == 1) - goto gonum; - draw_bar(); - break; - /* commands without arg */ case '<': if (history) { e = list_pop(&history); @@ -745,8 +745,29 @@ run(void) { go(current, 0); draw_page(); break; + case 'g': + ui.scroll = 0; + draw_page(); + break; + case 'G': + ui.scroll = list_len(&page) - LINES; + draw_page(); + break; + /* link numbers */ + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + ui.wantinput = 2; + ui.input[0] = c; + ui.input[1] = '\0'; + syncinput(); + il = 1; + if (digits(page->lastid) == 1) + goto gonum; + draw_bar(); + break; /* commands with arg */ case ':': + case '+': ui.cmd = (char)c; ui.wantinput = 1; ui.input[0] = '\0';