diff options
Diffstat (limited to 'eventMouseDrag.go')
| -rw-r--r-- | eventMouseDrag.go | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/eventMouseDrag.go b/eventMouseDrag.go index 40f608d..4e2312d 100644 --- a/eventMouseDrag.go +++ b/eventMouseDrag.go @@ -24,6 +24,27 @@ import ( // this is run every time the user moves the mouse over the terminal window func mouseMove(g *gocui.Gui) { me.ok = true // this tells init() it's okay to work with gocui + + // this runs while the user moves the mouse. this highlights text + // toggle off all highlight views except for whatever is under the mouse + for _, view := range g.Views() { + view.Highlight = false + } + w, h := g.MousePosition() + if v, err := g.ViewByPosition(w, h); err == nil { + // todo: identify and highlight grid rows here + if me.dropdown.active || me.textbox.active { + if me.dropdown.tk != nil && me.dropdown.tk.v == v { + v.Highlight = true + } + if me.textbox.tk != nil && me.textbox.tk.v == v { + v.Highlight = true + } + } else { + v.Highlight = true + } + } + // very useful for debugging in the past. also, just fun if me.supermouse { w, h := g.MousePosition() @@ -45,16 +66,6 @@ func mouseMove(g *gocui.Gui) { // okay, the mouse is down and it has been long enough // the user is trying to drag something. let's figure out what - w, h := g.MousePosition() - // 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) { |
