hide commander and print messages in echo area
This commit is contained in:
parent
1f93dc2310
commit
055e8b792f
@ -111,12 +111,14 @@
|
||||
:default (and param (param.default self.frame))
|
||||
}))
|
||||
|
||||
(fn update-widget-state [{ : entry : completions-widget : prompt} result]
|
||||
(fn update-widget-state [{ : widget : entry : completions-widget : prompt} result]
|
||||
(set prompt.label (or result.prompt ""))
|
||||
(set entry.sensitive result.active)
|
||||
(if (not result.active)
|
||||
(completions-widget:hide))
|
||||
(set entry.text (or result.default result.error "")))
|
||||
(set entry.text (or result.default result.error ""))
|
||||
(widget.parent:set_visible_child_name
|
||||
(if result.active "commander" "echo-area")))
|
||||
|
||||
(fn on-input [self str]
|
||||
(match self.state
|
||||
|
@ -17,7 +17,10 @@
|
||||
:transition_duration 100
|
||||
})
|
||||
commander (Command.commander self)
|
||||
echo-area (Gtk.Label { :label "echo area visible, commander hidden" })
|
||||
echo-area (Gtk.Label {
|
||||
:xalign 0
|
||||
:margin_start 10
|
||||
})
|
||||
window (Gtk.Window {
|
||||
:title "Dunlin"
|
||||
:default_width 800
|
||||
@ -59,7 +62,7 @@
|
||||
(when (not (commander:active?))
|
||||
(match (recogniser:accept-event event)
|
||||
[name params] (commander:invoke-interactively name params)
|
||||
(nil prompt) (print "prompted" prompt)))
|
||||
(nil prompt) (tset echo-area :label prompt)))
|
||||
(when (and (commander:active?)
|
||||
(= keymap.keyval.Escape event.keyval))
|
||||
(commander:deactivate))
|
||||
@ -78,6 +81,8 @@
|
||||
:window window
|
||||
:buffer nil
|
||||
:content contentwidget
|
||||
:message (fn [self message]
|
||||
(tset echo-area :label message))
|
||||
:show-buffer (fn [self b]
|
||||
(each [_ w (pairs (contentwidget:get_children))]
|
||||
(w:hide))
|
||||
|
@ -126,7 +126,7 @@
|
||||
_
|
||||
(let [syms (lume.map key-sequence index->string)]
|
||||
(set key-sequence [])
|
||||
(values nil (.. "No binding for " (table.concat syms " "))))))))
|
||||
(values nil (.. (table.concat syms " ") " is undefined")))))))
|
||||
}))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user