Commit Diff


commit - c5f624649e7019257e2fe3514a15a61049ce7f52
commit + ea63925028272e2324146df682e86f4ca3c60a8c
blob - c1a3a0dd71323c91b35785b5108a0ecd647a46ff
blob + 79ebe209795f743920f3b58d88ece2df42401d8f
--- session.c
+++ session.c
@@ -37,8 +37,10 @@ switch_to_tab(struct tab *tab)
 	current_tab = tab;
 	tab->flags &= ~TAB_URGENT;
 
-	if (operating && tab->flags & TAB_LAZY)
-		load_url_in_tab(tab, tab->hist_cur->h, NULL, 0);
+	if (operating && tab->flags & TAB_LAZY) {
+		tab->flags ^= TAB_LAZY;
+		load_url_in_tab(tab, tab->hist_cur->h, NULL, 1);
+	}
 }
 
 unsigned int
@@ -68,16 +70,16 @@ new_tab(const char *url, const char *base, struct tab 
 	TAILQ_INIT(&tab->buffer.page.head);
 
 	tab->id = tab_new_id();
-	if (!operating)
-		tab->flags |= TAB_LAZY;
-	switch_to_tab(tab);
 
 	if (after != NULL)
 		TAILQ_INSERT_AFTER(&tabshead, after, tab, tabs);
 	else
 		TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
 
+	if (!operating)
+		tab->flags |= TAB_LAZY;
 	load_url_in_tab(tab, url, base, 0);
+	switch_to_tab(tab);
 	return tab;
 }
 
blob - 1ea5112a17d01a050a1dc8527e82f6fd19684a21
blob + 0f24a1f1b10e35f9093653ca360142ece41f7059
--- telescope.c
+++ telescope.c
@@ -894,25 +894,13 @@ do_load_url(struct tab *tab, const char *url, const ch
 }
 
 /*
- * Load url in tab.  If tab is marked as lazy, only prepare the url
- * but don't load it.  If tab is lazy and a url was already prepared,
- * do load it!
+ * Load url in tab and handle history.  If a tab is marked as lazy, only
+ * prepare the url but don't load it.
  */
 void
 load_url(struct tab *tab, const char *url, const char *base, int nohist)
 {
-	int lazy;
-
-	lazy = tab->flags & TAB_LAZY;
-
-	if (lazy && tab->hist_cur != NULL) {
-		lazy = 0;
-		tab->flags &= ~TAB_LAZY;
-	}
-
-	/* can't have both nohist and lazy at the same time. */
-	if (nohist && lazy)
-		nohist = 0;
+	int lazy = tab->flags & TAB_LAZY;
 
 	if (!nohist && (!lazy || tab->hist_cur == NULL)) {
 		if (tab->hist_cur != NULL)