cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 60cf41e7dd66897e6987704921b6cd57da1f084f
parent 39339c348f593bda9ca0a556affa38cd5e15138c
Author: Arav K <nothien@uber.space>
Date:   Tue, 22 Sep 2020 10:20:39 +0100

Add 'H' to view all page history

This adds a command, 'H', to view all the URLs in the page history.  It
first prints backward URLs, then the current URL (marked with an
asterisk), followed by forward URLs.

Diffstat:
Msrc/gmnlm.c | 37+++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -59,6 +59,7 @@ const char *help_msg = "N\tFollow Nth link (where N is a number)\n" "b\tBack (in the page history)\n" "f\tForward (in the page history)\n" + "H\tView all page history\n" "m\tSave bookmark\n" "M\tBrowse bookmarks\n" "\n" @@ -206,16 +207,6 @@ do_prompts(const char *prompt, struct browser *browser) set_url(browser, browser->history->url, NULL); result = PROMPT_ANSWERED; goto exit; - case 'm': - if (in[1]) break; - save_bookmark(browser); - result = PROMPT_AGAIN; - goto exit; - case 'M': - if (in[1]) break; - open_bookmarks(browser); - result = PROMPT_ANSWERED; - goto exit; case 'f': if (in[1]) break; if (!browser->history->next) { @@ -227,6 +218,32 @@ do_prompts(const char *prompt, struct browser *browser) set_url(browser, browser->history->url, NULL); result = PROMPT_ANSWERED; goto exit; + case 'H': + if (in[1]) break; + struct history *cur = browser->history; + while (cur->prev) cur = cur->prev; + while (cur != browser->history) { + fprintf(browser->tty, " %s\n", cur->url); + cur = cur->next; + } + fprintf(browser->tty, "* %s\n", cur->url); + cur = cur->next; + while (cur) { + fprintf(browser->tty, " %s\n", cur->url); + cur = cur->next; + } + result = PROMPT_AGAIN; + goto exit; + case 'm': + if (in[1]) break; + save_bookmark(browser); + result = PROMPT_AGAIN; + goto exit; + case 'M': + if (in[1]) break; + open_bookmarks(browser); + result = PROMPT_ANSWERED; + goto exit; case '/': if (in[1]) break; if ((r = regcomp(&browser->regex, &in[1], REG_EXTENDED)) != 0) {