Commit Diff


commit - 028fff5774c0d94d4a1aad1a18ba0efa7aa429d3
commit + 2fd6d754260a291d40eb2353ba2eb7453e348173
blob - 0446d63dea36127e13ce95f106e5544668cb46e1
blob + 5e81c69e04676a27822b4ad6e9d48670eb4646e8
--- parser.c
+++ parser.c
@@ -35,12 +35,22 @@ parser_parse(struct tab *tab, const char *chunk, size_
 int
 parser_free(struct tab *tab)
 {
-	int r;
+	int	 r;
+	char	*tilde, *slash;
 
 	r = tab->buffer.page.free(&tab->buffer.page);
 
 	/* fallback to the host as title if nothing else */
-	if (*tab->buffer.page.title == '\0')
+	if (*tab->buffer.page.title != '\0')
+		return r;
+
+	if ((tilde = strstr(tab->hist_cur->h, "/~")) != NULL) {
+		strlcpy(tab->buffer.page.title, tilde+1,
+		    sizeof(tab->buffer.page.title));
+
+		if ((slash = strchr(tab->buffer.page.title, '/')) != NULL)
+			*slash = '\0';
+	} else
 		strlcpy(tab->buffer.page.title, tab->uri.host,
 		    sizeof(tab->buffer.page.title));