Commit Diff


commit - ed383cf46b080fe7b60358ed3e26b0c8af363847
commit + 2eef3403bf2cebb4f2d37886babe4a83063d6daf
blob - 46909951cae3e185aadf7c9e92763352af8c8076
blob + 135e8f3fcd9aa1ce68a299ecea4f6ccd80c295b5
--- telescope.c
+++ telescope.c
@@ -314,6 +314,9 @@ load_gemini_url(struct tab *tab, const char *url)
 {
 	size_t		 len;
 
+	stop_tab(tab);
+	tab->id = tab_new_id();
+
 	len = sizeof(tab->hist_cur->h);
 	imsg_compose(netibuf, IMSG_GET, tab->id, 0, -1,
 	    tab->hist_cur->h, len);
blob - 770cd15b4aa867fe99e607edc4b6132311fa998d
blob + f44ef7b4895b0e78c2c4144f2cd2ddd44f15787b
--- telescope.h
+++ telescope.h
@@ -251,6 +251,7 @@ void		 save_session(void);
 void		 textplain_initparser(struct parser*);
 
 /* ui.c */
+unsigned int	 tab_new_id(void);
 int		 ui_init(int, char * const*);
 void		 ui_on_tab_loaded(struct tab*);
 void		 ui_on_tab_refresh(struct tab*);
blob - 1e48de7d89831f79371f4f47521d1be4742a5ce1
blob + 6acd41123e6eea27bf7d590063f9cf67f396fca0
--- ui.c
+++ ui.c
@@ -1876,6 +1876,12 @@ switch_to_tab(struct tab *tab)
 	}
 
 	tab->flags |= TAB_CURRENT;
+}
+
+unsigned int
+tab_new_id(void)
+{
+	return tab_counter++;
 }
 
 static struct tab *
@@ -1892,7 +1898,7 @@ new_tab(const char *url)
 
 	TAILQ_INIT(&tab->window.head);
 
-	tab->id = tab_counter++;
+	tab->id = tab_new_id();
 	switch_to_tab(tab);
 
 	if (TAILQ_EMPTY(&tabshead))