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
main
Daniel Barlow 2023-01-17 10:45:19 +00:00
parent bf8fa80dac
commit 3a577b71d8
1 changed files with 10 additions and 8 deletions

View File

@ -47,14 +47,16 @@
#$1.buffer.name] #$1.buffer.name]
[:url [:url
(fn [term] (fn [term]
(if (> (# term) 2) (let [from-history
(icollect [v (_G.history:find-distinct term)] (if (> (# term) 2)
(let [label (.. v.url " " (or v.title ""))] (icollect [v (_G.history:find-distinct term)]
(completion { :text v.url (let [label (.. v.url " " (or v.title ""))]
:widget (Gtk.Button { : label }) (completion { :text v.url
:value v.url :widget (Gtk.Button { : label })
}))) :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}]