From 74d485c96d9eb9898c2ae861747dc894b600716b Mon Sep 17 00:00:00 2001 From: ayn2op Date: Sat, 14 Mar 2026 21:09:33 -0400 Subject: [PATCH] refactor(ui/chat): handle guild tree selection via TreeViewSelectedEvent --- go.mod | 2 +- go.sum | 4 ++-- internal/ui/chat/guilds_tree.go | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 0198396..c18f8cb 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/alecthomas/chroma/v2 v2.23.1 github.com/andybalholm/brotli v1.2.0 github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97 - github.com/ayn2op/tview v0.0.0-20260314084311-e6fda4e5838b + github.com/ayn2op/tview v0.0.0-20260315010736-d2153f13054e github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb github.com/diamondburned/arikawa/v3 v3.6.1-0.20260311205148-176ad9b9440f github.com/diamondburned/ningen/v3 v3.0.1-0.20260306213430-5a08d3a709b4 diff --git a/go.sum b/go.sum index 57d7e38..9babccd 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwTo github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97 h1:WujETUV+v0DEJyZgjeLzQvihWyL80c0Tg4qf0dDo+Io= github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97/go.mod h1:3kFnpNCa3dF6WryzOMCDao7PfZ7DTCh+pievlfuwV80= -github.com/ayn2op/tview v0.0.0-20260314084311-e6fda4e5838b h1:ZGDcIf5Vrk+/Tl3GMaxuXNQek8oT/FW27nn5xdkXx5A= -github.com/ayn2op/tview v0.0.0-20260314084311-e6fda4e5838b/go.mod h1:lZ8RdOegQWBQafTOasGE7Ps1/Ymy4jmXoPt5vz2QsS0= +github.com/ayn2op/tview v0.0.0-20260315010736-d2153f13054e h1:BRXzZGLUR+zTZ2Dg4/FF1vMNTsZ+6ftmazbUFUIwgJ8= +github.com/ayn2op/tview v0.0.0-20260315010736-d2153f13054e/go.mod h1:lZ8RdOegQWBQafTOasGE7Ps1/Ymy4jmXoPt5vz2QsS0= github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ= github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/ui/chat/guilds_tree.go b/internal/ui/chat/guilds_tree.go index f3e965e..8d687af 100644 --- a/internal/ui/chat/guilds_tree.go +++ b/internal/ui/chat/guilds_tree.go @@ -55,7 +55,6 @@ func newGuildsTree(cfg *config.Config, chatView *Model) *guildsTree { }). SetGraphics(cfg.Theme.GuildsTree.Graphics). SetGraphicsColor(tcell.GetColor(cfg.Theme.GuildsTree.GraphicsColor)). - SetSelectedFunc(gt.onSelected). SetTitle("Guilds") return gt @@ -396,6 +395,9 @@ func (gt *guildsTree) collapseParentNode(node *tview.TreeNode) { func (gt *guildsTree) HandleEvent(event tcell.Event) tview.Command { switch event := event.(type) { + case *tview.TreeViewSelectedEvent: + gt.onSelected(event.Node) + return nil case *tview.KeyEvent: handler := gt.TreeView.HandleEvent