Commit Diff


commit - 9e97090d644b51c0cb6e049e8c777139b18457fa
commit + 43f29a9e9dd602a83a5f6a7f2c6a80ee990f7917
blob - 9787cc37342d7cd238dceda333eba50504d1b807
blob + 50e9680b2b04b69c68ec24ec802de40ee532834a
--- cmd.c
+++ cmd.c
@@ -565,7 +565,7 @@ cmd_load_url(struct buffer *buffer)
 	GUARD_RECURSIVE_MINIBUFFER();
 
 	enter_minibuffer(sensible_self_insert, lu_select, exit_minibuffer,
-	    &lu_history, NULL, NULL);
+	    &lu_history, compl_lu, NULL);
 	strlcpy(ministate.prompt, "Load URL: ", sizeof(ministate.prompt));
 }
 
@@ -575,7 +575,7 @@ cmd_load_current_url(struct buffer *buffer)
 	GUARD_RECURSIVE_MINIBUFFER();
 
 	enter_minibuffer(sensible_self_insert, lu_select, exit_minibuffer,
-	    &lu_history, NULL, NULL);
+	    &lu_history, compl_lu, NULL);
 	strlcpy(ministate.prompt, "Load URL: ", sizeof(ministate.prompt));
 	strlcpy(ministate.buf, current_tab->hist_cur->h, sizeof(ministate.buf));
 	ministate.buffer.cpoff = utf8_cplen(ministate.buf);
blob - acaf0e4902dc24ff80cf96fadde92416aa753f9f
blob + 27e9f1421a74a09bb2f79e3182a628e354849c82
--- compl.c
+++ compl.c
@@ -20,8 +20,27 @@
 
 #include "compl.h"
 #include "telescope.h"
+#include "session.h"
 
 /*
+ * Provide completions for load-url (lu).
+ */
+const char *
+compl_lu(void **data, void **ret, const char **descr)
+{
+	struct history_item **state = (struct history_item **)data;
+
+	/* first time: init the state */
+	if (*state == NULL)
+		*state = history.items;
+
+	if (*state == history.items + history.len)
+		return NULL;
+
+	return (*state)++->uri;
+}
+
+/*
  * Provide completions for execute-extended-command (eecmd).
  */
 const char *
blob - 895de6a295c781e74309b1b0bb844f82ae5e6f11
blob + c2d3ddef9936e81d473da6e75de86d4af340c7e3
--- include/compl.h
+++ include/compl.h
@@ -17,6 +17,7 @@
 #ifndef COMPL_H
 #define COMPL_H
 
+const char	*compl_lu(void **, void **, const char **);
 const char	*compl_eecmd(void **, void **, const char **);
 const char	*compl_ts(void **, void **, const char **);
 const char	*compl_ls(void **, void **, const char **);