From 37723c2b9a91ad001828f492970b94ce91ff6d4c Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 6 Feb 2025 22:26:47 -0600 Subject: [PATCH] stdout still doesn't work with the mouse correctly --- eventMouseMove.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/eventMouseMove.go b/eventMouseMove.go index 16dee6c..77ce7f8 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -31,6 +31,22 @@ func mouseMove(g *gocui.Gui) { } } + // toggle off all highlight vies except for whatever is under the mouse + for _, view := range g.Views() { + view.Highlight = false + } + if v, err := g.ViewByPosition(w, h); err == nil { + v.Highlight = true + } + + // create the 'msg' view if it does not yet exist // TODO: put this somewhere more correct + if widgetView, _ := g.View("msg"); widgetView == nil { + if createStdout(g) { + return + } + return + } + if me.globalMouseDown && me.dropdown.active { log.Info("can't drag while dropdown is active", w, h) return @@ -86,20 +102,6 @@ func mouseMove(g *gocui.Gui) { log.Info(fmt.Sprintf("findByXY() empty. nothing to move at (%d,%d)", w, h)) } } - - if widgetView, _ := g.View("msg"); widgetView == nil { - if createStdout(g) { - return - } - return - } - - for _, view := range g.Views() { - view.Highlight = false - } - if v, err := g.ViewByPosition(w, h); err == nil { - v.Highlight = true - } } // this is how the window gets dragged around