1
0
Fork 0
mirror of https://git.sr.ht/~sircmpwn/gmni synced 2024-05-07 13:36:03 +02:00

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.
This commit is contained in:
René Wagner 2021-07-01 20:22:01 +02:00 committed by Drew DeVault
parent 9b95e38eef
commit 0b55ef24a1

View File

@ -598,15 +598,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;