Commit Diff


commit - 2c05b26da3a2b21a6804583e47f984ec4b1f898c
commit + 4bb6a4fa12277e60cec320dacf7968754b26db7d
blob - 0b1c8d05ba35e39564f8b5b7d407b5baf5fcc7ed
blob + 12f73a5299bb55bacec7fc2f7e9a085802ec7e7d
--- defaults.c
+++ defaults.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
+ * Copyright (c) 2021, 2024 Omar Polo <op@omarpolo.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -39,6 +39,7 @@ int fringe_ignore_offset = 1;
 int hide_pre_blocks = 0;
 int hide_pre_closing_line = 0;
 int hide_pre_context = 0;
+int load_url_use_heuristic = 1;
 int max_killed_tabs = 10;
 int olivetti_mode = 1;
 int set_title = 1;
@@ -569,6 +570,8 @@ config_setvari(const char *var, int val)
 			max_killed_tabs = MIN(val, 128);
 	} else if (!strcmp(var, "fringe-ignore-offset")) {
 		fringe_ignore_offset = !!val;
+	} else if (!strcmp(var, "load-url-use-heuristic")) {
+		load_url_use_heuristic = !!val;
 	} else {
 		return 0;
 	}
blob - adc2a2c9a0fc0506cb9b3aab32c4f063334118ad
blob + a558b19b541506194c96f09d04c09a3ff190ab53
--- include/defaults.h
+++ include/defaults.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
+ * Copyright (c) 2021, 2024 Omar Polo <op@omarpolo.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -29,6 +29,7 @@ extern int	 fringe_ignore_offset;
 extern int	 hide_pre_blocks;
 extern int	 hide_pre_closing_line;
 extern int	 hide_pre_context;
+extern int	 load_url_use_heuristic;
 extern int	 max_killed_tabs;
 extern int	 olivetti_mode;
 extern int	 set_title;
blob - 2d9a872abf6fe7e335474c0504f25b6f685d18ac
blob + 21f18edee99c8447770391cb07d4502ee20e3bcf
--- minibuffer.c
+++ minibuffer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
+ * Copyright (c) 2021, 2024 Omar Polo <op@omarpolo.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "defaults.h"
 #include "fs.h"
 #include "iri.h"
 #include "minibuffer.h"
@@ -331,11 +332,19 @@ void
 lu_select(void)
 {
 	char url[GEMINI_URL_LEN+1];
+	char *base = NULL;
 
 	minibuffer_hist_save_entry();
-	humanify_url(minibuffer_compl_text(), url, sizeof(url));
+
+	if (load_url_use_heuristic)
+		humanify_url(minibuffer_compl_text(), url, sizeof(url));
+	else {
+		strlcpy(url, minibuffer_compl_text(), sizeof(url));
+		base = current_tab->hist_cur->h;
+	}
+
 	exit_minibuffer();
-	load_url_in_tab(current_tab, url, NULL, LU_MODE_NOCACHE);
+	load_url_in_tab(current_tab, url, base, LU_MODE_NOCACHE);
 }
 
 void
blob - de1b33d6cc260103c6a4d5ab79e00aae29b17512
blob + 14643b4a19ce91c201e4f68d8c3bfacbe99f2c82
--- telescope.1
+++ telescope.1
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2021, 2022 Omar Polo <op@omarpolo.com>
+.\" Copyright (c) 2021, 2022, 2024 Omar Polo <op@omarpolo.com>
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
@@ -11,7 +11,7 @@
 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.Dd $Mdocdate: January 05 2022$
+.Dd $Mdocdate: January 15 2024$
 .Dt TELESCOPE 1
 .Os
 .Sh NAME
@@ -165,7 +165,7 @@ All text is assumed to be encoded in UTF-8 (or ASCII).
 User-entered URLs, given as argument on the command line or entered
 with
 .Ic load-url ,
-are intepreted with a simple heuristic:
+by default are intepreted with a simple heuristic:
 .Bl -bullet -compact
 .It
 if it's a proper absolute URL then use it as-is,
@@ -301,6 +301,11 @@ Defaults to zero.
 URL for the new tab page.
 Defaults to
 .Dq about:new .
+.It Ic load-url-use-heuristic
+If zero, don't use euristics for the url given to
+.Ic load-url
+and use the current URL as base.
+Defaults to 1.
 .It Ic max-killed-tabs
 .Pq integer
 The maximum number of closed tabs to keep track of, defaults to 10.
@@ -829,6 +834,11 @@ Select and visit a link using the minibuffer.
 Edit the current URL.
 .It Ic load-url
 Prompt for an URL.
+Use the same heuristic as the URLs given as a command-line argument,
+unless the
+.Ic load-url-use-heuristic
+option is unsed, in which case the URL is resolved using the current
+one as base.
 .It Ic next-page
 Go forward in the page history.
 .It Ic olivetti-mode