Commit Diff


commit - 0a5a10e89b303fbbe95fb2014d3453af65993b95
commit + dc5df781e91cacf1776473dad50da7a7e749d152
blob - 78d151f4dba52503568224e8c42654f315aba34d
blob + e709cac2efc709636a8779ee056ead5ce41ddc49
--- gemtext.c
+++ gemtext.c
@@ -185,6 +185,9 @@ parse_title(struct parser *p, enum line_type t, const 
 	if (len == 0)
 		return emit_line(p, t, NULL, NULL);
 
+	if (t == LINE_TITLE_1 && *p->title == '\0')
+		strncpy(p->title, buf, MIN(sizeof(p->title)-1, len));
+
 	if ((l = calloc(1, len+1)) == NULL)
 		return 0;
 	memcpy(l, buf, len);
blob - 6dcb8f235e8c26e0188846169cfb36cd4ea4a490
blob + 8bad95b2dfd0f9ddca765cb59044a608c8da203a
--- telescope.h
+++ telescope.h
@@ -21,6 +21,9 @@
 
 #include "url.h"
 
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #define GEMINI_URL_LEN 1024
 
 enum imsg_type {
@@ -70,6 +73,7 @@ typedef void (imsg_handlerfn)(struct imsg*, size_t);
 
 struct parser {
 	const char	*name;
+	char		 title[32+1];
 	char		*buf;
 	size_t		 len;
 	size_t		 cap;
blob - 38dc1c64aa048ff3a3dd0f5d471b6acfa5f1eeef
blob + 81d0afaea9e344f3135c1fa639428e11a2f09ade
--- ui.c
+++ ui.c
@@ -70,9 +70,6 @@
 
 #define TAB_CURRENT	0x1
 
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-
 struct minibuf_histhead;
 
 static struct event	stdioev, winchev;
@@ -1284,6 +1281,7 @@ redraw_tabline(void)
 {
 	struct tab	*tab;
 	int		 current;
+	const char	*title;
 
 	werase(tabline);
 	wbkgd(tabline, A_REVERSE);
@@ -1292,11 +1290,14 @@ redraw_tabline(void)
 	TAILQ_FOREACH(tab, &tabshead, tabs) {
 		current = tab->flags & TAB_CURRENT;
 
+		if (*(title = tab->page.title) == '\0')
+			title = tab->urlstr;
+
 		if (current)
 			wattron(tabline, A_UNDERLINE);
 
-		wprintw(tabline, "%s%d:todo title ",
-		    current ? "*" : " ", tab->id);
+		wprintw(tabline, "%s%d: %s",
+		    current ? "*" : " ", tab->id, title);
 
 		if (current)
 			wattroff(tabline, A_UNDERLINE);