eufon

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 400124570db749ad9738492b59252ad245f54358
parent a16d1a46e38391be03666b5db1170c27137aa39c
Author: Daniel Barlow <dan@telent.net>
Date:   Thu, 10 Mar 2022 09:37:26 +0000

add completions to text entry

Diffstat:
Mjust/just.fnl | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/just/just.fnl b/just/just.fnl @@ -64,6 +64,13 @@ progress, trough { (text:find "^http") text (.. "https://" text))) +(local completions + (doto (Gtk.ListStore) + (: :set_column_types [lgi.GObject.Type.STRING]))) + +(fn add-autocomplete-suggestion [url] + (completions:append [url])) + (local keysyms { :Escape 0xff1b }) @@ -74,9 +81,11 @@ progress, trough { :new (fn [webview] (let [url (Gtk.Entry { - ;; :completion (Gtk.EntryCompletion {:model completions :text_column 0 }) + :completion (Gtk.EntryCompletion {:model completions :text_column 0 }) :on_activate - #(webview:visit (to-uri $1.text)) + (fn [event] + (add-autocomplete-suggestion event.text) + (webview:visit (to-uri event.text))) :on_key_release_event #(if (= $2.keyval keysyms.Escape) (tset $1 :text webview.properties.uri))