keep cleaning the 'msg' stdout handling code
This commit is contained in:
parent
2c07da350a
commit
bff0943dc5
|
@ -84,16 +84,20 @@ func mouseMove(g *gocui.Gui) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// if me.mouse.globalMouseDown {
|
// drag whatever was set to drag
|
||||||
// log.Info("msgMouseDown == true")
|
|
||||||
// plugin will segfault if you don't keep this inside a check for msgMouseDown
|
|
||||||
// don't move this code out of here
|
|
||||||
var found bool = false
|
|
||||||
if me.mouse.currentDrag != nil {
|
if me.mouse.currentDrag != nil {
|
||||||
// me.mouse.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h))
|
// me.mouse.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h))
|
||||||
me.mouse.currentDrag.moveNew()
|
me.mouse.currentDrag.moveNew()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.Info(fmt.Sprintf("gui toolkit error. nothing to drag at (%d,%d)", w, h))
|
||||||
|
return
|
||||||
|
|
||||||
|
// if me.mouse.globalMouseDown {
|
||||||
|
// log.Info("msgMouseDown == true")
|
||||||
|
// plugin will segfault if you don't keep this inside a check for msgMouseDown
|
||||||
|
// don't move this code out of here
|
||||||
|
/*
|
||||||
// new function that is smarter
|
// new function that is smarter
|
||||||
if tk := findWindowUnderMouse(); tk != nil {
|
if tk := findWindowUnderMouse(); tk != nil {
|
||||||
tk.setAsDragging()
|
tk.setAsDragging()
|
||||||
|
@ -120,18 +124,9 @@ func mouseMove(g *gocui.Gui) {
|
||||||
// tk.moveNew()
|
// tk.moveNew()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if tk.node.WidgetType == widget.Label {
|
|
||||||
me.mouse.currentDrag = tk
|
|
||||||
// tk.moveNew()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
if !found {
|
*/
|
||||||
log.Info(fmt.Sprintf("findByXY() empty. nothing to move at (%d,%d)", w, h))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tk *guiWidget) setAsDragging() {
|
func (tk *guiWidget) setAsDragging() {
|
||||||
|
|
|
@ -156,6 +156,15 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
if tk.v == nil {
|
if tk.v == nil {
|
||||||
|
v, _ := me.baseGui.View("msg")
|
||||||
|
if v != nil {
|
||||||
|
// fmt.Fprintln(outf, "found msg")
|
||||||
|
tk.v = v
|
||||||
|
}
|
||||||
|
return len(p), nil
|
||||||
|
}
|
||||||
|
tk.refreshStdout()
|
||||||
|
/*
|
||||||
// optionally write the output to /tmp
|
// optionally write the output to /tmp
|
||||||
s := fmt.Sprint(string(p))
|
s := fmt.Sprint(string(p))
|
||||||
s = strings.TrimSuffix(s, "\n")
|
s = strings.TrimSuffix(s, "\n")
|
||||||
|
@ -182,6 +191,7 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
|
||||||
tk.v.Clear()
|
tk.v.Clear()
|
||||||
fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
|
fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue