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]
[: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}]