about summary refs log tree commit diff
path: root/surf.c
diff options
context:
space:
mode:
authorEnno Boland (tox) <tox@s01.de>2010-01-29 09:44:14 +0100
committerEnno Boland (tox) <tox@s01.de>2010-01-29 09:44:14 +0100
commit94601622a1494f9f7ffb514f662cd118c5c86dc1 (patch)
treed2e192baf729f86fa15fc2fbe9b30291e0716f72 /surf.c
parentfixing manpage (diff)
downloadsurf-94601622a1494f9f7ffb514f662cd118c5c86dc1.tar.gz
surf-94601622a1494f9f7ffb514f662cd118c5c86dc1.tar.bz2
surf-94601622a1494f9f7ffb514f662cd118c5c86dc1.zip
_SURF_URI gets initialised as soon as the window opens.
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/surf.c b/surf.c
index 796ee96..62b4948 100644
--- a/surf.c
+++ b/surf.c
@@ -435,14 +435,23 @@ void
 loaduri(Client *c, const Arg *arg) {
 	char *u;
 	const char *uri = (char *)arg->v;
+	Arg a = { .b = FALSE };
 
+	if(strcmp(uri, "") == 0)
+		return;
 	u = g_strrstr(uri, "://") ? g_strdup(uri)
 		: g_strdup_printf("http://%s", uri);
-	webkit_web_view_load_uri(c->view, u);
-	c->progress = 0;
-	c->title = copystr(&c->title, u);
-	g_free(u);
-	update(c);
+	/* prevents endless loop */
+	if(c->uri && strcmp(u, c->uri) == 0) {
+		reload(c, &a);
+	}
+	else {
+		webkit_web_view_load_uri(c->view, u);
+		c->progress = 0;
+		c->title = copystr(&c->title, u);
+		g_free(u);
+		update(c);
+	}
 }
 
 void
@@ -551,6 +560,7 @@ newclient(void) {
 	g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL);
 	g_free(uri);
 	setatom(c, findprop, "");
+	setatom(c, uriprop, "");
 
 	c->download = NULL;
 	c->title = NULL;