Touch ups and additional capabilities added to fifo functionality. Sample Fenrir scripts in extra
This commit is contained in:
+10
-3
@@ -210,25 +210,32 @@ func (ui *Ui) onKeyEvent(key Key) {
|
||||
}
|
||||
|
||||
func (ui *Ui) onCommandEvent(cmd string) {
|
||||
ui.DispatchCommand(cmd)
|
||||
}
|
||||
|
||||
// DispatchCommand sends a command to its registered listeners and reports
|
||||
// whether any listener accepted it.
|
||||
func (ui *Ui) DispatchCommand(cmd string) bool {
|
||||
ta := strings.SplitN(cmd, " ", 2)
|
||||
t := ta[0]
|
||||
rest := ""
|
||||
if len(ta) == 2 {
|
||||
rest = ta[1]
|
||||
}
|
||||
handled := false
|
||||
if ui.commandListeners[t] != nil {
|
||||
handled = true
|
||||
for _, listener := range ui.commandListeners[t] {
|
||||
listener(ui, rest)
|
||||
}
|
||||
}
|
||||
if ui.commandListeners["*"] != nil {
|
||||
handled = true
|
||||
for _, listener := range ui.commandListeners["*"] {
|
||||
listener(ui, cmd)
|
||||
}
|
||||
}
|
||||
// if ui.activeElement != nil {
|
||||
// ui.activeElement.View.uiKeyEvent(key)
|
||||
// }
|
||||
return handled
|
||||
}
|
||||
|
||||
func (ui *Ui) Add(name string, view View) error {
|
||||
|
||||
Reference in New Issue
Block a user