diff options
| author | Jeff Carr <[email protected]> | 2023-12-03 16:08:39 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-12-03 16:59:57 -0600 |
| commit | 9d075afb1df62276dea06be4a188eaee8fc69420 (patch) | |
| tree | 915472449c509dc7fd77f18fa43edecc46e56f46 /examples/console-ui-helloworld/newJ.go | |
| parent | 7880d9df6de1040258bea966f040e12be6205af1 (diff) | |
clean and rename examples
fix syntax
try new goreadme
remove autogenerated go readme.md
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'examples/console-ui-helloworld/newJ.go')
| -rw-r--r-- | examples/console-ui-helloworld/newJ.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/console-ui-helloworld/newJ.go b/examples/console-ui-helloworld/newJ.go new file mode 100644 index 0000000..47c7439 --- /dev/null +++ b/examples/console-ui-helloworld/newJ.go @@ -0,0 +1,46 @@ +// Copyright 2014 The gocui Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "errors" + "fmt" + "log" + "strings" + + "github.com/awesome-gocui/gocui" +) + +var topX int = 2 +var bottomX int = 20 +var topY int = 2 +var bottomY int = 7 + +func newJ(g *gocui.Gui) error { + // maxX, maxY := g.Size() + name := fmt.Sprintf("jcarr %v test ", idxView) + v, err := g.SetView(name, topX, topY, bottomX, bottomY, 0) + if err == nil { + return err + } + if !errors.Is(err, gocui.ErrUnknownView) { + return err + } + + v.Wrap = true + fmt.Fprintln(v, name) + fmt.Fprintln(v, strings.Repeat("foo\n", 2)) + // fmt.Fprintln(v, strings.Repeat(name+" ", 30)) + log.Println("newJ added a new view", v.Name()) + + if _, err := g.SetCurrentView(name); err != nil { + return err + } + + views = append(views, name) + curView = len(views) - 1 + idxView += 1 + return nil +} |
