Touch ups and additional capabilities added to fifo functionality. Sample Fenrir scripts in extra

This commit is contained in:
Storm Dragon
2026-09-06 17:55:21 -04:00
parent 4ef8553c7d
commit 6817ecd90b
7 changed files with 75 additions and 37 deletions
+10 -3
View File
@@ -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 {