~julienxx/castor9

c9c28215513b8c35a8ff574ee9bb8ce16fb01a78 — Julien Blanchard 3 years ago e29ac5e
Can edit current URL
1 files changed, 11 insertions(+), 14 deletions(-)

M castor.c
M castor.c => castor.c +11 -14
@@ 43,6 43,7 @@ int request(Url *u);
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 *root;
Panel *backp;
Panel *fwdp;
Panel *entryp;
Panel *urlp;
Panel *textp;
Panel *statusp;
Panel *popup;


@@ 121,9 121,9 @@ show(Ctx *c)
{
	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 @@ gemini_get(Url *url)
			close(fd);

			page(url);
			message("Castor9");
			message("castor9");
		}else{
			while((line = Brdstr(&body, '\n', 0)) != nil){
				if(strbeg(line, "=>") == 0){


@@ 472,12 472,12 @@ gemini_put(Response *r)
	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 @@ entryhit(Panel *p, char *t)
		t = smprint("gemini://%s", t);
			
	gemini_get(urlparse(nil, t));
	
	plinitentry(entryp, PACKN|FILLX, 0, "", entryhit);
	pldraw(root, screen);
}

void


@@ 733,18 730,18 @@ message(char *s, ...)
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);