diff options
| author | Jeff Carr <[email protected]> | 2023-04-13 07:04:41 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-04-13 07:04:41 -0500 |
| commit | 20987c868a7f290b92f811e07084aae5f38ff170 (patch) | |
| tree | 984356ed444c3fe3f677a7e310039eacd947f7e5 /toolkit/gocui/showMsg.go | |
| parent | ecf3893fa9b69f71f5e84bcedae1934f49f98a7a (diff) | |
gocui: preliminary log() output window
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/showMsg.go')
| -rw-r--r-- | toolkit/gocui/showMsg.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/toolkit/gocui/showMsg.go b/toolkit/gocui/showMsg.go index a03a64d..2a0a873 100644 --- a/toolkit/gocui/showMsg.go +++ b/toolkit/gocui/showMsg.go @@ -11,12 +11,15 @@ import ( "github.com/awesome-gocui/gocui" ) +var outputW int = 80 +var outputH int = 24 + func moveMsg(g *gocui.Gui) { mx, my := g.MousePosition() if !movingMsg && (mx != initialMouseX || my != initialMouseY) { movingMsg = true } - g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+20, my-yOffset+7, 0) + g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+outputW, my-yOffset+outputH, 0) } func showMsg(g *gocui.Gui, v *gocui.View) error { @@ -31,14 +34,16 @@ func showMsg(g *gocui.Gui, v *gocui.View) error { if l, err = v.Line(cy); err != nil { l = "" } + // setOutput(me.rootNode) maxX, maxY := g.Size() - if v, err := g.SetView("msg", maxX/2-10, maxY/2, maxX/2+10, maxY/2+7, 0); err == nil || errors.Is(err, gocui.ErrUnknownView) { + if v, err := g.SetView("msg", maxX/2, maxY/2, maxX/2+outputW, maxY/2+outputH, 0); err == nil || errors.Is(err, gocui.ErrUnknownView) { v.Clear() v.SelBgColor = gocui.ColorCyan v.SelFgColor = gocui.ColorBlack l += "foo\n" + "bar\n" fmt.Fprintln(v, l) } + g.SetViewOnTop("msg") return nil } |
