diff --git a/README.md b/README.md
index d68381569be5736bac9887345b5c053e69393b5a..3cb5f020cab021c3b4ffd7eb98908c76c352e90d 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,8 @@ - default 4 char indenting
- k command to remove the bookmark for the current page
- e[N] command to open a link in default external program (requires `xdg-open`)
- t[N] command to download the content behind a link to a temporary file
+- b & f commands to navigate history can jump multiple entries at once
+- colored headings & links
The actual colors used depend on your terminal palette:
- heading 1: light red
@@ -39,11 +41,13 @@ - preformatted text: light gray
Besides this rendering adjustments i'll try to keep track of upstream changes or send patches to upstream.
-## Dependencies:
+## Usage
-- A POSIX-like system and a C11 compiler
-- OpenSSL
-- [scdoc](https://sr.ht/~sircmpwn/scdoc/) (optional, build only)
+See `gmni(1)`, `cgmnlm(1)`.
+
+# Installation
+
+* ArchLinux and derivates: https://aur.archlinux.org/packages/cgmnlm-git/
## Compiling
@@ -54,6 +58,9 @@ $ make
# make install
```
-## Usage
+### Dependencies:
+
+- A POSIX-like system and a C11 compiler
+- OpenSSL
+- [scdoc](https://sr.ht/~sircmpwn/scdoc/) (optional)
-See `gmni(1)`, `cgmnlm(1)`.
diff --git a/src/gmnlm.c b/src/gmnlm.c
index cc429cdfe6d482e549afee2bd9b05520985e92f9..eaa34c055cbb92564ebd279fcf06189dc577360d 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -84,8 +84,8 @@ "[N]\t\tFollow Nth link (where N is a number)\n"
"p[N]\t\tPrint URL of Nth link (where N is a number)\n"
"e[N]\t\tSend URL of Nth link in external default program\n"
"t[N]\t\tDownload content of Nth link to a temporary file\n"
- "b\t\tBack (in the page history)\n"
- "f\t\tForward (in the page history)\n"
+ "b[N]\t\tJump back N entries in history, N is optional, default 1\n"
+ "f[N]\t\tJump forward N entries in history, N is optional, default 1\n"
"H\t\tView all page history\n"
"m\t\tSave bookmark\n"
"M\t\tBrowse bookmarks\n"
@@ -546,6 +546,8 @@
struct link *link = browser->links;
char *endptr = NULL;
int linksel = 0;
+ int historyhops = 1;
+
char *in = NULL;
size_t l = 0;
ssize_t n = getline(&in, &l, browser->tty);
@@ -554,7 +556,7 @@ result = PROMPT_QUIT;
goto exit;
}
in[n - 1] = 0; // Remove LF
-
+
int r;
switch (in[0]) {
case '\0':
@@ -565,25 +567,24 @@ if (in[1]) break;
result = PROMPT_QUIT;
goto exit;
case 'b':
- if (in[1]) break;
- if (!browser->history->prev) {
- fprintf(stderr, "At beginning of history\n");
- result = PROMPT_AGAIN;
- goto exit;
+ if (in[1]) historyhops =(int)strtol(in+1, &endptr, 10);
+ while (historyhops > 0) {
+ if (browser->history->prev) {
+ browser->history = browser->history->prev;
+ }
+ historyhops--;
}
- if (in[1]) break;
- browser->history = browser->history->prev;
set_url(browser, browser->history->url, NULL);
result = PROMPT_ANSWERED;
goto exit;
case 'f':
- if (in[1]) break;
- if (!browser->history->next) {
- fprintf(stderr, "At end of history\n");
- result = PROMPT_AGAIN;
- goto exit;
+ if (in[1]) historyhops =(int)strtol(in+1, &endptr, 10);
+ while (historyhops > 0) {
+ if (browser->history->next) {
+ browser->history = browser->history->next;
+ }
+ historyhops--;
}
- browser->history = browser->history->next;
set_url(browser, browser->history->url, NULL);
result = PROMPT_ANSWERED;
goto exit;