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 86b299819c86758f2b537c1de0475a2906f0a4d2
parent 18ead2644a8c525d1d3bbc729d9ccd9aa7e0d63c
Author: René Wagner <rwa@clttr.info>
Date:   Thu,  1 Jul 2021 20:22:01 +0200

add hints to history for easier navigation

This commit adds simple hints in front of the URIs on the history
page to directly show what needs to be typed to jump to this page.

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

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -684,15 +684,19 @@ do_prompts(const char *prompt, struct browser *browser) case 'H': if (in[1]) break; struct history *cur = browser->history; - while (cur->prev) cur = cur->prev; + int hist_count = 0; + while (cur->prev) { + cur = cur->prev; + hist_count++; + } while (cur != browser->history) { - fprintf(browser->tty, " %s\n", cur->url); + fprintf(browser->tty, "b%-3i %s\n", hist_count--, cur->url); cur = cur->next; } - fprintf(browser->tty, "* %s\n", cur->url); + fprintf(browser->tty, "* %s\n", cur->url); cur = cur->next; while (cur) { - fprintf(browser->tty, " %s\n", cur->url); + fprintf(browser->tty, "f%-3i %s\n", ++hist_count, cur->url); cur = cur->next; } result = PROMPT_AGAIN;