diff options
| author | Jeff Carr <[email protected]> | 2025-02-01 17:17:32 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-01 17:17:32 -0600 |
| commit | 2062060dac99b4a6bda8705adfb1696cb01be50c (patch) | |
| tree | 416c414173efe2d28231bc1a52bd39a2583fdfe3 | |
| parent | 7557486b13a39f25ac77f53cbf0571f262c52cec (diff) | |
hmm. notsure
| -rw-r--r-- | eventMouseMove.go | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/eventMouseMove.go b/eventMouseMove.go index 3ff05f3..b42f324 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -32,15 +32,15 @@ func mouseMove(g *gocui.Gui) { tk.dumpWidget("mouseMove()") } } + if msgMouseDown { + // plugin will segfault if you don't keep this inside a check for msgMouseDown + // don't move this code out of here for _, tk := range findByXY(w, h) { - if tk.node == nil { - log.Info("mouseMove() tk.node == nil") - } else { - if tk.node.WidgetType == widget.Stdout && msgMouseDown { - moveMsg(g) - return - } + if tk.node.WidgetType == widget.Stdout { + // moveMsg(g) + tk.moveNew(g) + return } } } @@ -58,6 +58,19 @@ func mouseMove(g *gocui.Gui) { } // this is how the window gets dragged around +func (tk *guiWidget) moveNew(g *gocui.Gui) { + mx, my := g.MousePosition() + if !me.movingMsg && (mx != initialMouseX || my != initialMouseY) { + me.movingMsg = true + } + // tk.MoveToOffset(mx-xOffset, my-yOffset) + g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+outputW, my-yOffset+outputH+me.FramePadH, 0) + me.startOutputW = mx - xOffset + me.startOutputH = my - yOffset + g.SetViewOnBottom("msg") +} + +// this is how the window gets dragged around func moveMsg(g *gocui.Gui) { mx, my := g.MousePosition() if !me.movingMsg && (mx != initialMouseX || my != initialMouseY) { |
