From f65bdd6e455096f8270f7e2910e30a8091d01911 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Tue, 24 Feb 2026 20:51:47 -0500 Subject: [PATCH] refactor(root): adapt to flattened tview mouse and paste handlers --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/ui/root/view.go | 32 ++++++++++---------------------- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index 0313a93..8ba1e98 100644 --- a/go.mod +++ b/go.mod @@ -8,9 +8,9 @@ require ( github.com/BurntSushi/toml v1.6.0 github.com/alecthomas/chroma/v2 v2.23.1 github.com/andybalholm/brotli v1.2.0 - github.com/ayn2op/tview v0.0.0-20260225005318-47ca92c515c0 + github.com/ayn2op/tview v0.0.0-20260225014619-7f27f376aea9 github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb - github.com/diamondburned/arikawa/v3 v3.6.1-0.20260221051847-b81b70d1a5cb + github.com/diamondburned/arikawa/v3 v3.6.1-0.20260225013123-e0278d45ffd2 github.com/diamondburned/ningen/v3 v3.0.1-0.20250920191746-98fbd92e134d github.com/gdamore/tcell/v3 v3.1.2 github.com/gen2brain/beeep v0.11.2 diff --git a/go.sum b/go.sum index ee12add..65c9e1c 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= -github.com/ayn2op/tview v0.0.0-20260225005318-47ca92c515c0 h1:aWW3YTB4CKSrHlzg542uT7gIo812+VvNYIOogu5GAAs= -github.com/ayn2op/tview v0.0.0-20260225005318-47ca92c515c0/go.mod h1:lZ8RdOegQWBQafTOasGE7Ps1/Ymy4jmXoPt5vz2QsS0= +github.com/ayn2op/tview v0.0.0-20260225014619-7f27f376aea9 h1:6zEOzR3v3bylvKLrNUiQ2ykVGzZilVKypdUU3EcVK7c= +github.com/ayn2op/tview v0.0.0-20260225014619-7f27f376aea9/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= @@ -25,8 +25,8 @@ github.com/dchest/jsmin v1.0.0 h1:Y2hWXmGZiRxtl+VcTksyucgTlYxnhPzTozCwx9gy9zI= github.com/dchest/jsmin v1.0.0/go.mod h1:AVBIund7Mr7lKXT70hKT2YgL3XEXUaUk5iw9DZ8b0Uc= github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb h1:6S+TKObz6+Io2c8IOkcbK4Sz7nj6RpEVU7TkvmsZZcw= github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb/go.mod h1:wf3nKtOnQqCp7kp9xB7hHnNlZ6m3NoiOxjrB9hFRq4Y= -github.com/diamondburned/arikawa/v3 v3.6.1-0.20260221051847-b81b70d1a5cb h1:sBcyty++NvgR6SiAV5CuiTW3AKiAdtJ1NWE7jovZnUc= -github.com/diamondburned/arikawa/v3 v3.6.1-0.20260221051847-b81b70d1a5cb/go.mod h1:TpV2GvCJIYSwAXUEAx4sutPcftyAbVidiFlG6l7K0go= +github.com/diamondburned/arikawa/v3 v3.6.1-0.20260225013123-e0278d45ffd2 h1:H8n6WnLQ+CYE1RwzTYCd+jJNNpInMqFnavdSN9TKuQ8= +github.com/diamondburned/arikawa/v3 v3.6.1-0.20260225013123-e0278d45ffd2/go.mod h1:TpV2GvCJIYSwAXUEAx4sutPcftyAbVidiFlG6l7K0go= github.com/diamondburned/ningen/v3 v3.0.1-0.20250920191746-98fbd92e134d h1:wS6HWl86RFItw38sUSdXlulj0VarV4G+9Rlv8j+p3oQ= github.com/diamondburned/ningen/v3 v3.0.1-0.20250920191746-98fbd92e134d/go.mod h1:9PWnJlArEASrZQI89KQiBJBYOEDcsDyfhFcxRTL8eO4= github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ= diff --git a/internal/ui/root/view.go b/internal/ui/root/view.go index 0e83289..ea049af 100644 --- a/internal/ui/root/view.go +++ b/internal/ui/root/view.go @@ -165,30 +165,18 @@ func (v *View) Blur() { v.Box.Blur() } -func (v *View) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive) { - return v.WrapMouseHandler(func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive) { - if v.inner == nil { - return false, nil - } - handler := v.inner.MouseHandler() - if handler == nil { - return false, nil - } - return handler(action, event, setFocus) - }) +func (v *View) MouseHandler(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive) { + if v.inner == nil { + return false, nil + } + return v.inner.MouseHandler(action, event, setFocus) } -func (v *View) PasteHandler() func(text string, setFocus func(p tview.Primitive)) { - return v.WrapPasteHandler(func(text string, setFocus func(p tview.Primitive)) { - if v.inner == nil { - return - } - handler := v.inner.PasteHandler() - if handler == nil { - return - } - handler(text, setFocus) - }) +func (v *View) PasteHandler(text string, setFocus func(p tview.Primitive)) { + if v.inner == nil { + return + } + v.inner.PasteHandler(text, setFocus) } func (v *View) IsDirty() bool {