handle ESC in text entry to revert changes to current url

phoen
Daniel Barlow 2022-03-10 00:18:35 +00:00
parent a928c40cd0
commit a16d1a46e3
3 changed files with 10 additions and 2 deletions

View File

@ -7,7 +7,6 @@ Touchscreen-friendly wrapper around Webkit
- downloads (pass to download manager)
- find out if it's going to eat cpu like luakit does
- some kind of bookmarks/favourites/pinned tabs/memory of visited sites
- ESC in url bar cancels typing
- warning for insecure sites
- try video and audio
- does it save passwords? find out! where?

View File

@ -64,6 +64,10 @@ progress, trough {
(text:find "^http") text
(.. "https://" text)))
(local keysyms {
:Escape 0xff1b
})
(local
Navbar
{
@ -73,6 +77,9 @@ progress, trough {
;; :completion (Gtk.EntryCompletion {:model completions :text_column 0 })
:on_activate
#(webview:visit (to-uri $1.text))
:on_key_release_event
#(if (= $2.keyval keysyms.Escape)
(tset $1 :text webview.properties.uri))
})
stop (doto (Gtk.Button {
:on_clicked #(webview:stop-loading)

View File

@ -99,6 +99,7 @@
(relay-event webview event-name))
(let [page (widget:append_page webview.widget)]
(tset views page webview)
(tset self :properties webview.properties)
(set widget.page page)
page))
@ -109,11 +110,12 @@
(self:show-overview)
))
:focus-view (fn [_ view]
:focus-view (fn [self view]
(when view
(set foreground-view view)
(each [_ prop (ipairs relay-events)]
(listeners:notify prop (. view.properties prop)))
(tset self :properties view.properties)
(set widget.page (widget:page_num view.widget))))
:show-overview (fn [self]