Ejemplo n.º 1
0
func (c *column) CreateViews(g *gocui.Gui, colv *gocui.View) error {
	if c.isActive {
		colv.FgColor = gocui.ColorCyan | gocui.AttrBold
	} else {
		colv.FgColor = gocui.ColorDefault
	}
	x, y, maxX, maxY, err := g.ViewPosition(colv.Name())
	y = y + 2
	if err != nil {
		return err
	}
	maxIssues := maxY / LinesPerEntry
	c.maxIssues = maxIssues
	for i := 0; i < maxIssues; i++ {
		v, err := g.SetView(fmt.Sprintf("col-%s-%d", c.name, i),
			x, y+(i*LinesPerEntry), maxX, y+((i+1)*LinesPerEntry))
		if err != nil {
			if err != gocui.ErrorUnkView {
				return err
			}
		}
		v.SelBgColor = gocui.ColorRed
		v.Frame = false
		v.Wrap = true
	}
	return c.redraw(g)
}
Ejemplo n.º 2
0
func moveView(g *gocui.Gui, v *gocui.View, dx, dy int) error {
	name := v.Name()
	x0, y0, x1, y1, err := g.ViewPosition(name)
	if err != nil {
		return err
	}
	if _, err := g.SetView(name, x0+dx, y0+dy, x1+dx, y1+dy); err != nil {
		return err
	}
	return nil
}