Improve action menu escape handling

Make the F11 action menu close through a shared close action so Escape and the explicit Close actions menu item follow the same path. Treat Escape-prefixed Up and Down events as close inputs while the action menu is active, which handles termbox InputAlt behavior after pressing Escape. Preserve and restore the user/channel tree selection across action menu open and close, and preserve selection across live tree rebuilds.

Tested with: GOCACHE=/tmp/barnard-go-cache go test ./...
This commit is contained in:
Storm Dragon
2026-06-28 23:57:29 -04:00
parent 5ac6703489
commit 342f934029
8 changed files with 343 additions and 142 deletions
+3 -2
View File
@@ -43,6 +43,7 @@ type Barnard struct {
selectedUser *gumble.User
adminTargetUser *gumble.User
adminTargetChan *gumble.Channel
adminReturnItem uiterm.TreeItem
statusText string
statusNotice bool
@@ -144,7 +145,7 @@ func (b *Barnard) TreeItemKeyPress(ui *uiterm.Ui, tree *uiterm.Tree, item uiterm
delete(b.MutedChannels, treeItem.Channel.ID)
}
b.UiTree.Rebuild()
b.RebuildUserChannelTreePreservingSelection()
b.Ui.Refresh()
}
if key == *b.Hotkeys.VolumeDown {
@@ -169,7 +170,7 @@ func (b *Barnard) TreeItemKeyPress(ui *uiterm.Ui, tree *uiterm.Tree, item uiterm
treeItem.User.AudioSource.SetGain(treeItem.User.Volume)
}
}
b.UiTree.Rebuild()
b.RebuildUserChannelTreePreservingSelection()
b.Ui.Refresh()
}
if key == *b.Hotkeys.VolumeDown {