Commit Diff


commit - 1b0e6efceb972ec76c7283d0a9e6f837425bd1fd
commit + bc55cdb9b8678689c6f39504ccf17cf1d0f943d5
blob - 3e64e6af109507e77600a49c5b8c434a59f6968b
blob + 46a9b460d3f3c93beb6740d499fcfadd415807cd
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,7 @@
+2021-08-12  Omar Polo  <op@omarpolo.com>
+
+	* telescope.c (load_url): improved reload command: it doesn't push the current url to the history anymore.
+
 2021-08-03  Omar Polo  <op@omarpolo.com>
 
 	* pages/about_new.gmi.in: add link to veronica-2.  reorder links
blob - c4e4801a051319e8e36bdd92f8b4c5b8909460e9
blob + 767741497ace904ea7b086af834965318b22d7fd
--- cmd.c
+++ cmd.c
@@ -291,7 +291,7 @@ cmd_push_button(struct buffer *buffer)
 
 	switch (vl->parent->type) {
 	case LINE_LINK:
-		load_url_in_tab(current_tab, vl->parent->alt, NULL);
+		load_url_in_tab(current_tab, vl->parent->alt, NULL, 0);
 		break;
 	case LINE_PRE_START:
 		l = TAILQ_NEXT(vl->parent, lines);
@@ -568,7 +568,7 @@ cmd_load_current_url(struct buffer *buffer)
 void
 cmd_reload_page(struct buffer *buffer)
 {
-	load_url_in_tab(current_tab, current_tab->hist_cur->h, NULL);
+	load_url_in_tab(current_tab, current_tab->hist_cur->h, NULL, 1);
 }
 
 void
@@ -586,7 +586,7 @@ cmd_bookmark_page(struct buffer *buffer)
 void
 cmd_list_bookmarks(struct buffer *buffer)
 {
-	load_url_in_tab(current_tab, "about:bookmarks", NULL);
+	load_url_in_tab(current_tab, "about:bookmarks", NULL, 0);
 }
 
 void
blob - d411d634d08b25e5ef43f02b9860ef4345f436d3
blob + 98e0a90400e163cc52fefa931180c34ecfa8de3f
--- minibuffer.c
+++ minibuffer.c
@@ -207,7 +207,7 @@ ir_select_gemini(void)
 	memcpy(&uri, &tab->uri, sizeof(tab->uri));
 	phos_uri_set_query(&uri, ministate.buf);
 	phos_serialize_uri(&uri, buf, sizeof(buf));
-	load_url_in_tab(tab, buf, NULL);
+	load_url_in_tab(tab, buf, NULL, 0);
 }
 
 void
@@ -224,7 +224,7 @@ lu_select(void)
 {
 	exit_minibuffer();
 	minibuffer_hist_save_entry();
-	load_url_in_tab(current_tab, ministate.buf, NULL);
+	load_url_in_tab(current_tab, ministate.buf, NULL, 0);
 }
 
 void
@@ -262,7 +262,7 @@ ls_select(void)
 	}
 
 	exit_minibuffer();
-	load_url_in_tab(current_tab, l->alt, NULL);
+	load_url_in_tab(current_tab, l->alt, NULL, 0);
 }
 
 static inline void
blob - 615597265f0e43658496215a61fe82564857f9b7
blob + 0bf6e95212e5111ca64597b50810501f53237a9b
--- telescope.c
+++ telescope.c
@@ -806,7 +806,7 @@ do_load_url(struct tab *tab, const char *url, const ch
  * do load it!
  */
 void
-load_url(struct tab *tab, const char *url, const char *base)
+load_url(struct tab *tab, const char *url, const char *base, int nohist)
 {
 	int lazy;
 
@@ -817,7 +817,11 @@ load_url(struct tab *tab, const char *url, const char 
 		tab->flags &= ~TAB_LAZY;
 	}
 
-	if (!lazy || tab->hist_cur == NULL) {
+	/* can't have both nohist and lazy at the same time. */
+	if (nohist && lazy)
+		nohist = 0;
+
+	if (!nohist && (!lazy || tab->hist_cur == NULL)) {
 		if (tab->hist_cur != NULL)
 			hist_clear_forward(&tab->hist,
 			    TAILQ_NEXT(tab->hist_cur, entries));
blob - 3e1f9768b8d9f56c3488a6bfa2bda2789d0c6e19
blob + d16801bd0a336a700fc3b24645b3bc0269ba511c
--- telescope.h
+++ telescope.h
@@ -320,7 +320,7 @@ void		 sandbox_fs_process(void);
 
 /* telescope.c */
 void		 gopher_send_search_req(struct tab *, const char *);
-void		 load_url(struct tab *, const char *, const char *);
+void		 load_url(struct tab *, const char *, const char *, int);
 int		 load_previous_page(struct tab*);
 int		 load_next_page(struct tab*);
 void		 free_tab(struct tab *);
blob - e0bd2158c686645f62e455d8456a9991120eae78
blob + 2c550124b6532106073abc2987c978dc57e8a631
--- ui.c
+++ ui.c
@@ -949,16 +949,16 @@ stop_loading_anim(struct tab *tab)
 }
 
 void
-load_url_in_tab(struct tab *tab, const char *url, const char *base)
+load_url_in_tab(struct tab *tab, const char *url, const char *base, int nohist)
 {
 	if (!operating) {
-		load_url(tab, url, base);
+		load_url(tab, url, base, nohist);
 		return;
 	}
 
 	message("Loading %s...", url);
 	start_loading_anim(tab);
-	load_url(tab, url, base);
+	load_url(tab, url, base, nohist);
 
 	redraw_tab(tab);
 }
@@ -970,7 +970,7 @@ switch_to_tab(struct tab *tab)
 	tab->flags &= ~TAB_URGENT;
 
 	if (operating && tab->flags & TAB_LAZY)
-		load_url_in_tab(tab, tab->hist_cur->h, NULL);
+		load_url_in_tab(tab, tab->hist_cur->h, NULL, 0);
 }
 
 unsigned int
@@ -1004,7 +1004,7 @@ new_tab(const char *url, const char *base)
 	else
 		TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
 
-	load_url_in_tab(tab, url, base);
+	load_url_in_tab(tab, url, base, 0);
 	return tab;
 }
 
blob - 02b2dd49988a6e2179550843d0adbc68170ccd23
blob + d043c8026f06fcfa44dd26e43e5abc4f11700f9e
--- ui.h
+++ ui.h
@@ -122,7 +122,7 @@ void		 restore_excursion(struct excursion *, struct bu
 void		 global_key_unbound(void);
 struct vline	*adjust_line(struct vline *, struct buffer *);
 void		 start_loading_anim(struct tab *);
-void		 load_url_in_tab(struct tab *, const char *, const char *);
+void		 load_url_in_tab(struct tab *, const char *, const char *, int);
 void		 switch_to_tab(struct tab *);
 struct buffer	*current_buffer(void);
 struct tab	*new_tab(const char *, const char *base);