commit 3a577b71d89b90dcb5505aea8650f84275d6dd96 parent bf8fa80dac53803fd46d4e7ae95d609d9b3a44f5 Author: Daniel Barlow <dan@telent.net> Date: Tue, 17 Jan 2023 10:45:19 +0000 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 Diffstat:
| M | command.fnl | | | 18 | ++++++++++-------- |
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git 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}]