diff -r d310bf4b5f74 sys/man/1/mothra --- a/sys/man/1/mothra Sat Sep 01 15:11:46 2018 +0200 +++ b/sys/man/1/mothra Mon Sep 03 14:07:33 2018 -0400 @@ -100,6 +100,10 @@ .B moth mode menu option again exits moth mode. .TP +.B back +Navigate backwards through visited link history. The order of this +navigation is independent from the order shown in the alt display. +.TP .B snarf Copy the current entry text or selected page text to snarf buffer. If nothing is selected, the current URL is copied. @@ -126,6 +130,9 @@ .B a Toggle alt display. .TP +.BI b +Navigate backwards through visited link history. +.TP .BI g " url Go to the page with the given URL. .TP diff -r d310bf4b5f74 sys/src/cmd/mothra/mothra.c --- a/sys/src/cmd/mothra/mothra.c Sat Sep 01 15:11:46 2018 +0200 +++ b/sys/src/cmd/mothra/mothra.c Mon Sep 03 14:07:33 2018 -0400 @@ -79,6 +79,8 @@ Url *selection=0; int mothmode; int kickpipe[2]; +int history[NWWW]; +int histindex = 0; void docmd(Panel *, char *); void doprev(Panel *, int, int); @@ -93,6 +95,7 @@ char *buttons[]={ "alt display", "moth mode", + "back", "snarf", "paste", "search", @@ -556,6 +559,7 @@ int i; new=www(index); if(new==current && (tag==0 || tag[0]==0)) return; + history[histindex] = index; if(current) current->yoffs=plgetpostextview(text); current=new; @@ -685,6 +689,9 @@ else message("Usage: j index"); break; + case 'b': + hit3(3, 2); + break; case 'm': mothon(current, !mothmode); break; @@ -1054,6 +1061,7 @@ } plinitlist(list, PACKN|FILLX, genwww, 8, doprev); if(defdisplay) pldraw(list, screen); + histindex = (histindex+1) % NWWW; setcurrent(i, selection->tag); break; case GIF: @@ -1193,15 +1201,19 @@ mothon(current, !mothmode); break; case 2: + histindex = (histindex-1) % NWWW; + doprev(nil, 1, wwwtop-history[histindex]-1); + break; + case 3: snarf(plkbfocus); break; - case 3: + case 4: paste(plkbfocus); break; - case 4: + case 5: search(); break; - case 5: + case 6: if(!selection){ message("no url selected"); break; @@ -1221,11 +1233,11 @@ fprint(fd, "

%s\n", urlstr(selection), urlstr(selection)); close(fd); break; - case 6: + case 7: snprint(name, sizeof(name), "file:%s/hit.html", mkhome()); geturl(name, -1, 1, 0); break; - case 7: + case 8: if(confirm(3)) exits(0); break;