From 99e9481a72b48726126a3b1856ab5c7dabafd26a Mon Sep 17 00:00:00 2001 From: ayn2op Date: Mon, 20 Apr 2026 20:38:54 -0400 Subject: [PATCH] fix(ui): sequence state-sensitive command flows and bump tview --- go.mod | 2 +- go.sum | 4 ++-- internal/ui/chat/message_input.go | 2 +- internal/ui/chat/model.go | 7 ++----- internal/ui/root/model.go | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 16631e1..9979c0b 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.1 github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97 - github.com/ayn2op/tview v0.0.0-20260420160540-112aca6def81 + github.com/ayn2op/tview v0.0.0-20260420233216-e6ed1e0a9300 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 0c3e701..096b45c 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/andybalholm/brotli v1.2.1 h1:R+f5xP285VArJDRgowrfb9DqL18yVK0gKAW/F+eT github.com/andybalholm/brotli v1.2.1/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-20260420160540-112aca6def81 h1:I1rz8MKjFynyEfocUidca5DgxexayCdrT9Vch/76JW4= -github.com/ayn2op/tview v0.0.0-20260420160540-112aca6def81/go.mod h1:K4qMjKIPIYbOM7aP7dXFRdTrAtVbpWPPT8Q93+DBfKI= +github.com/ayn2op/tview v0.0.0-20260420233216-e6ed1e0a9300 h1:NgyEvrOHIZIRddzWNgPNaMYOHe6m4QLjiMznstdzhUo= +github.com/ayn2op/tview v0.0.0-20260420233216-e6ed1e0a9300/go.mod h1:K4qMjKIPIYbOM7aP7dXFRdTrAtVbpWPPT8Q93+DBfKI= github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8= github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= diff --git a/internal/ui/chat/message_input.go b/internal/ui/chat/message_input.go index 5c28dd1..8ec8734 100644 --- a/internal/ui/chat/message_input.go +++ b/internal/ui/chat/message_input.go @@ -167,7 +167,7 @@ func (mi *messageInput) Update(msg tview.Msg) tview.Cmd { } // Apply key edits first, then recompute autocomplete through Msg/Cmd. - return tview.Batch(handler(msg), mi.tabSuggest()) + return tview.Sequence(handler(msg), mi.tabSuggest()) } } return handler(msg) diff --git a/internal/ui/chat/model.go b/internal/ui/chat/model.go index 680e2de..0679092 100644 --- a/internal/ui/chat/model.go +++ b/internal/ui/chat/model.go @@ -312,10 +312,7 @@ func (m *Model) Update(msg tview.Msg) tview.Cmd { m.messageInput.SetPlaceholder(tview.NewLine(tview.NewSegment(text, tcell.StyleDefault.Dim(true)))) return focusCmd case QuitMsg: - return tview.Batch( - m.closeState(), - tview.Quit(), - ) + return m.closeState() case tview.ModalDoneMsg: if m.HasLayer(confirmModalLayerName) { m.RemoveLayer(confirmModalLayerName) @@ -354,7 +351,7 @@ func (m *Model) Update(msg tview.Msg) tview.Cmd { return nil case keybind.Matches(msg, m.cfg.Keybinds.Logout.Keybind): - return tview.Batch(m.closeState(), m.logout()) + return tview.Sequence(m.closeState(), m.logout()) } case tabSuggestMsg: // Member search completes in a command goroutine; resume suggestion diff --git a/internal/ui/root/model.go b/internal/ui/root/model.go index a3ff0c1..882c258 100644 --- a/internal/ui/root/model.go +++ b/internal/ui/root/model.go @@ -125,7 +125,7 @@ func (m *Model) Update(msg tview.Msg) tview.Cmd { if m.inner != nil { innerCmd = m.inner.Update(chat.QuitMsg{}) } - return tview.Batch(innerCmd, tview.Quit()) + return tview.Sequence(innerCmd, tview.Quit()) } }