git: 9front

Download patch

ref: a2f5f47d218aa49ba6a79cde319a185e80255e87
parent: 672d5efc9db08bbfcdbee5c629dd713f12e23211
author: stanley lieber <stanley.lieber@gmail.com>
date: Fri Sep 23 18:54:03 EDT 2011

mothra: add keyboard command j to jump to page from the list of previously viewed pages

--- a/sys/man/1/mothra
+++ b/sys/man/1/mothra
@@ -1,6 +1,6 @@
 .TH MOTHRA 1
 .SH NAME
-mothra \- retrieve World-Wide Web files
+mothra \- retrieve and display World-Wide Web files
 .SH SYNOPSIS
 .B mothra
 [
@@ -50,6 +50,15 @@
 the environment variable
 .BR $url .
 .PP
+There are a number of options:
+.TP
+.B  -d
+Debug mode.
+.TP
+.B -v
+Verbose mode. Causes HTML errors to appear in
+.B $home/lib/mothra/mothra.err
+.PP
 Mothra uses
 .IR webfs (4)
 to retrive the url data. The mountpoint, default is
@@ -100,6 +109,11 @@
 .TP
 .BI g " url
 Get the page with the given URL.
+.TP
+.BI j " n
+Jump to page
+.I n
+from the list of previously viewed pages.
 .TP
 .B r
 Reload the current page.
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -3,6 +3,7 @@
  */
 #include <u.h>
 #include <libc.h>
+#include <ctype.h>
 #include <draw.h>
 #include <event.h>
 #include <keyboard.h>
@@ -538,6 +539,13 @@
 				message("no url selected");
 		}
 		else geturl(s, GET, 0, 1, 0);
+		break;
+	case 'j':
+		s=arg(s);
+		if(isdigit(s))
+			geturl(www(atoi(s)-1)->url->fullname, GET, 0, 0, 0);
+		else
+			message("no url selected");
 		break;
 	case 'r':
 		s = arg(s);
--