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
This commit is contained in:
Daniel Barlow 2023-01-17 10:45:19 +00:00
parent bf8fa80dac
commit 3a577b71d8

View File

@ -47,6 +47,7 @@
#$1.buffer.name] #$1.buffer.name]
[:url [:url
(fn [term] (fn [term]
(let [from-history
(if (> (# term) 2) (if (> (# term) 2)
(icollect [v (_G.history:find-distinct term)] (icollect [v (_G.history:find-distinct term)]
(let [label (.. v.url " " (or v.title ""))] (let [label (.. v.url " " (or v.title ""))]
@ -54,7 +55,8 @@
:widget (Gtk.Button { : label }) :widget (Gtk.Button { : label })
:value v.url :value v.url
}))) })))
[])) [])]
(lume.unique (lume.concat from-history [(completion {:text term})]))))
#($1.buffer:location)] #($1.buffer:location)]
] ]
(fn [{:url url :buffer buffer}] (fn [{:url url :buffer buffer}]