shithub: castor9

Download patch

ref: c9c28215513b8c35a8ff574ee9bb8ce16fb01a78
parent: e29ac5e534dc9ec859b5698331fc4d6cf3ef191c
author: Julien Blanchard <julien@typed-hole.org>
date: Mon Jan 11 10:04:58 EST 2021

Can edit current URL

--- a/castor.c
+++ b/castor.c
@@ -43,6 +43,7 @@
 void gemini_get(Url *u);
 void gemini_put(Response *r);
 void texthit(Panel *p, int b, Rtext *t);
+void entryhit(Panel *p, char *t);
 void addbookmark(void);
 void showbookmarks(void);
 void message(char *s, ...);
@@ -51,7 +52,6 @@
 Panel *backp;
 Panel *fwdp;
 Panel *entryp;
-Panel *urlp;
 Panel *textp;
 Panel *statusp;
 Panel *popup;
@@ -121,9 +121,9 @@
 {
 	plinittextview(textp, PACKE|EXPAND, ZP, c->text, texthit);
 	pldraw(textp, screen);
-	plinitlabel(urlp, PACKN|FILLX, c->url->raw);
-	pldraw(urlp, screen);
-	message("Castor9");
+	plinitentry(entryp, PACKN|FILLX, 0, c->url->raw, entryhit);
+	pldraw(entryp, screen);
+	message("castor9");
 }
 
 void
@@ -391,7 +391,7 @@
 			close(fd);
 
 			page(url);
-			message("Castor9");
+			message("castor9");
 		}else{
 			while((line = Brdstr(&body, '\n', 0)) != nil){
 				if(strbeg(line, "=>") == 0){
@@ -472,12 +472,12 @@
 	char *url;
 	strncpy(buf, "", sizeof(buf)-1);
 	if(eenter(r->meta, buf, sizeof(buf), mouse) <= 0){
-		message("Castor9");
+		message("castor9");
 		return;
 	}
 	
 	url = smprint("%s?%s", r->url->raw, buf);
-	message("Castor9");
+	message("castor9");
 	gemini_get(urlparse(nil, url));
 }
 
@@ -666,9 +666,6 @@
 		t = smprint("gemini://%s", t);
 			
 	gemini_get(urlparse(nil, t));
-	
-	plinitentry(entryp, PACKN|FILLX, 0, "", entryhit);
-	pldraw(root, screen);
 }
 
 void
@@ -733,18 +730,18 @@
 void
 mkpanels(void)
 {
-	Panel *p, *ybar, *xbar, *m;
+	Panel *p, *ybar, *xbar, *m, *sp;
 
 	m = plmenu(0, 0, menu3, PACKN|FILLX, menuhit);
 	root = plpopup(0, EXPAND, 0, 0, m);
 	  p = plgroup(root, PACKN|FILLX);
-	    statusp = pllabel(p, PACKN|FILLX, "Castor!");
+	    statusp = pllabel(p, PACKN|FILLX, "castor9");
 	    plplacelabel(statusp, PLACEW);
 	    pllabel(p, PACKW, "Go: ");
 	    entryp = plentry(p, PACKN|FILLX, 0, "", entryhit);
 	  p = plgroup(root, PACKN|FILLX);
-	    urlp = pllabel(p, PACKN|FILLX, "");
-	    plplacelabel(urlp, PLACEW);
+	    sp= pllabel(p, PACKN|FILLX, "");
+	    plplacelabel(sp, PLACEW);
 	  p = plgroup(root, PACKN|EXPAND);
 	    ybar = plscrollbar(p, PACKW|USERFL);
 	    xbar = plscrollbar(p, IGNORE);