add back button
This commit is contained in:
parent
bc17c3af6c
commit
c1b7c2d777
|
@ -32,6 +32,7 @@
|
|||
(set property-change-listener cb))
|
||||
:location #(widget:get_uri)
|
||||
:visit (fn [_ u] (widget:load_uri u))
|
||||
:back #(widget:go_back)
|
||||
:properties props}))
|
||||
|
||||
(let [buffers {}]
|
||||
|
|
|
@ -41,6 +41,11 @@
|
|||
(fn [{:url url :buffer buffer}]
|
||||
(buffer:visit url)))
|
||||
|
||||
(define-command
|
||||
"back"
|
||||
[[:buffer Buffer.match #$1.buffer.name]]
|
||||
(fn [{: buffer}] (buffer:back)))
|
||||
|
||||
(fn find-command [name]
|
||||
(. commands name))
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
(local my-keymap {
|
||||
"g" ["visit-location" {:buffer #$1.buffer }]
|
||||
"BackSpace" ["back" {:buffer #$1.buffer }]
|
||||
"M-q" ["quit-browser" {}]
|
||||
"C-x" {
|
||||
"C-c" ["quit-browser" {}]
|
||||
|
|
11
keymap.fnl
11
keymap.fnl
|
@ -30,15 +30,15 @@
|
|||
(fn keychord->spec [keychord]
|
||||
(let [Mod Gdk.ModifierType
|
||||
symbol (keychord:match "(%w+)$")
|
||||
upper? (and (symbol:match "%u") true)
|
||||
modmask (accumulate [m (if upper? Mod.SHIFT_MASK 0)
|
||||
; upper? (and (symbol:match "%u") true)
|
||||
modmask (accumulate [m 0 ;(if upper? Mod.SHIFT_MASK 0)
|
||||
v (keychord:gmatch "(%w+)-")]
|
||||
(match (v:lower)
|
||||
"m" (bor m Mod.MOD1_MASK)
|
||||
"c" (bor m Mod.CONTROL_MASK)
|
||||
"s" (bor m Mod.MOD4_MASK)))]
|
||||
{
|
||||
:keyval (string.byte (symbol:lower))
|
||||
:keyval (Gdk.keyval_from_name symbol)
|
||||
: modmask
|
||||
}))
|
||||
|
||||
|
@ -131,9 +131,8 @@
|
|||
|
||||
|
||||
{ : recogniser
|
||||
:keyval {
|
||||
:Escape (Gdk.keyval_from_name "Escape")
|
||||
}
|
||||
:keyval (collect [_ name (ipairs [:Escape :Delete :BackSpace])]
|
||||
(values name (Gdk.keyval_from_name name)))
|
||||
:_ {
|
||||
;; symbols in _ are exported only for testing
|
||||
: keychord->spec
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
{:keyval 97 :modmask 4} true
|
||||
_ (assert false (view s))))
|
||||
|
||||
(let [s (keymap._.keychord->spec "C-M-Z")]
|
||||
(let [s (keymap._.keychord->spec "C-M-z")]
|
||||
(match s
|
||||
{:keyval 122 :modmask 13} true
|
||||
{:keyval 122 :modmask 12} true
|
||||
_ (assert false (view s))))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue