From 3a577b71d89b90dcb5505aea8650f84275d6dd96 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 17 Jan 2023 10:45:19 +0000 Subject: [PATCH] url completion allows current text as a completion option whatever the user has typed, it should be allowable as a URL otherwise we can only visit locations we've already been to --- command.fnl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/command.fnl b/command.fnl index 9eeb629..3396a21 100644 --- a/command.fnl +++ b/command.fnl @@ -47,14 +47,16 @@ #$1.buffer.name] [:url (fn [term] - (if (> (# term) 2) - (icollect [v (_G.history:find-distinct term)] - (let [label (.. v.url " " (or v.title ""))] - (completion { :text v.url - :widget (Gtk.Button { : label }) - :value v.url - }))) - [])) + (let [from-history + (if (> (# term) 2) + (icollect [v (_G.history:find-distinct term)] + (let [label (.. v.url " " (or v.title ""))] + (completion { :text v.url + :widget (Gtk.Button { : label }) + :value v.url + }))) + [])] + (lume.unique (lume.concat from-history [(completion {:text term})])))) #($1.buffer:location)] ] (fn [{:url url :buffer buffer}]