diff --git a/eventBindings.go b/eventBindings.go index 3633ca7..d869474 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -154,12 +154,12 @@ func theLetterD(g *gocui.Gui, v *gocui.View) error { fakeStartWidth = me.FakeW fakeStartHeight = me.TabH + me.FramePadH - if showDebug { + if me.showDebug { showFake() - showDebug = false + me.showDebug = false } else { hideFake() - showDebug = true + me.showDebug = true } return nil } diff --git a/eventMouse.go b/eventMouse.go index a6bd19e..31bf2d3 100644 --- a/eventMouse.go +++ b/eventMouse.go @@ -129,10 +129,7 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error { // this needs to go // event triggers when you push down on a mouse button func msgDown(g *gocui.Gui, v *gocui.View) error { - initialMouseX, initialMouseY = g.MousePosition() - - w := initialMouseX - h := initialMouseY + w, h := g.MousePosition() for _, tk := range findByXY(w, h) { tk.dumpWidget("msgDown()") @@ -140,8 +137,8 @@ func msgDown(g *gocui.Gui, v *gocui.View) error { vx, vy, _, _, err := g.ViewPosition("msg") if err == nil { - me.stdout.offsetW = initialMouseX - vx - me.stdout.offsetH = initialMouseY - vy + me.stdout.offsetW = w - vx + me.stdout.offsetH = h - vy } log.Info("setting mousedown to true") // msgMouseDown = true diff --git a/structs.go b/structs.go index b77225a..2a406be 100644 --- a/structs.go +++ b/structs.go @@ -25,10 +25,9 @@ import ( // 2025 note: doesn't seem terrible to call this 'me' anymore. notsure. var me config -var showDebug bool = true // todo: move this into config struct -var redoWidgets bool = true // todo: move this into config struct - -// todo: move all this to a protobuf. then, redo all this mess. it got me here, but now it's time to clean it up for good +// todo: move all this to a protobuf. then, redo all this mess. +// it got me here, but now it's time to clean it up for good +// I can't get a GO plugins that use protobuf to load yet (versioning mismatch) type config struct { baseGui *gocui.Gui // the main gocui handle treeRoot *tree.Node // the base of the binary tree. it should have id == 0 @@ -68,6 +67,7 @@ type config struct { globalMouseDown bool // yep, mouse is pressed newWindowTrigger chan bool // work around hack to redraw windows a bit after NewWindow() stdout stdout // information for the STDOUT window + showDebug bool // todo: move this into config struct } // settings for the stdout window @@ -82,13 +82,6 @@ type stdout struct { offsetH int // the current 'h' offset } -// deprecate these -var ( - initialMouseX, initialMouseY int - // initialMouseX, initialMouseY, xOffset, yOffset int - // msgMouseDown bool -) - // this is the gocui way // corner starts at in the upper left corner type rectType struct {