cgmnlm

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/cgmnlm.git
Log | Files | Refs | README | LICENSE

commit 1c9a6e6a35448b76063f16b0f6aaaf8d43ebee9a
parent 46b5d74576ffce397c83ac53ebfacb25e1cdc851
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 20 Sep 2020 21:29:40 -0400

Show [b]ack and [f]orward prompts contextually

Diffstat:
Msrc/gmnlm.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -278,8 +278,10 @@ display_gemini(struct browser *browser, struct gemini_response *resp) if (browser->pagination && row >= ws.ws_row - 4) { char prompt[4096]; snprintf(prompt, sizeof(prompt), "\n%s at %s\n" - "[Enter]: read more; [N]: follow Nth link; [b]ack; [f]orward; [q]uit\n" - "(more) => ", resp->meta, browser->plain_url); + "[Enter]: read more; [N]: follow Nth link; %s%s[q]uit\n" + "(more) => ", resp->meta, browser->plain_url, + browser->history->prev ? "[b]ack; " : "", + browser->history->next ? "[f]orward; " : ""); enum prompt_result result = PROMPT_AGAIN; while (result == PROMPT_AGAIN) { result = do_prompts(prompt, browser); @@ -485,10 +487,12 @@ main(int argc, char *argv[]) } snprintf(prompt, sizeof(prompt), "\n%s at %s\n" - "[N]: follow Nth link; [b]ack; [f]orward; [q]uit\n" + "[N]: follow Nth link; %s%s[q]uit\n" "=> ", resp.status == GEMINI_STATUS_SUCCESS ? resp.meta : "", - browser.plain_url); + browser.plain_url, + browser.history->prev ? "[b]ack; " : "", + browser.history->next ? "[f]orward; " : ""); gemini_response_finish(&resp); enum prompt_result result = PROMPT_AGAIN;