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))
|
: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 prompt.label (or result.prompt ""))
|
||||||
(set entry.sensitive result.active)
|
(set entry.sensitive result.active)
|
||||||
(if (not result.active)
|
(if (not result.active)
|
||||||
(completions-widget:hide))
|
(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]
|
(fn on-input [self str]
|
||||||
(match self.state
|
(match self.state
|
||||||
|
@ -17,7 +17,10 @@
|
|||||||
:transition_duration 100
|
:transition_duration 100
|
||||||
})
|
})
|
||||||
commander (Command.commander self)
|
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 {
|
window (Gtk.Window {
|
||||||
:title "Dunlin"
|
:title "Dunlin"
|
||||||
:default_width 800
|
:default_width 800
|
||||||
@ -59,7 +62,7 @@
|
|||||||
(when (not (commander:active?))
|
(when (not (commander:active?))
|
||||||
(match (recogniser:accept-event event)
|
(match (recogniser:accept-event event)
|
||||||
[name params] (commander:invoke-interactively name params)
|
[name params] (commander:invoke-interactively name params)
|
||||||
(nil prompt) (print "prompted" prompt)))
|
(nil prompt) (tset echo-area :label prompt)))
|
||||||
(when (and (commander:active?)
|
(when (and (commander:active?)
|
||||||
(= keymap.keyval.Escape event.keyval))
|
(= keymap.keyval.Escape event.keyval))
|
||||||
(commander:deactivate))
|
(commander:deactivate))
|
||||||
@ -78,6 +81,8 @@
|
|||||||
:window window
|
:window window
|
||||||
:buffer nil
|
:buffer nil
|
||||||
:content contentwidget
|
:content contentwidget
|
||||||
|
:message (fn [self message]
|
||||||
|
(tset echo-area :label message))
|
||||||
:show-buffer (fn [self b]
|
:show-buffer (fn [self b]
|
||||||
(each [_ w (pairs (contentwidget:get_children))]
|
(each [_ w (pairs (contentwidget:get_children))]
|
||||||
(w:hide))
|
(w:hide))
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
_
|
_
|
||||||
(let [syms (lume.map key-sequence index->string)]
|
(let [syms (lume.map key-sequence index->string)]
|
||||||
(set key-sequence [])
|
(set key-sequence [])
|
||||||
(values nil (.. "No binding for " (table.concat syms " "))))))))
|
(values nil (.. (table.concat syms " ") " is undefined")))))))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,3 +102,5 @@ but philosophically those things are not related to the command system.
|
|||||||
|
|
||||||
- hide commander when inactive and replace it with echo area
|
- hide commander when inactive and replace it with echo area
|
||||||
- move it to bottom?
|
- move it to bottom?
|
||||||
|
|
||||||
|
commander can't hide itself, it needs to ask its parent to hide it
|
||||||
|
Loading…
Reference in New Issue
Block a user