Exemple #1
1
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("contacts", 1, 1, 60, maxY-1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Highlight = true
	}
	if v, err := g.SetView("main", 60, 1, maxX-1, maxY-3); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Wrap = true
		v.WrapPrefix = "  "
	}
	if v, err := g.SetView("input", 60, maxY-3, maxX-1, maxY-1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Editable = true
		if err := g.SetCurrentView("input"); err != nil {
			return err
		}
	}
	return nil
}
Exemple #2
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()

	if v, err := g.SetView("help", maxX-23, 0, maxX-1, 3); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.Title = "Keybindings"
		fmt.Fprintln(v, "^a: Set mask")
		fmt.Fprintln(v, "^c: Exit")
	}

	if v, err := g.SetView("input", 0, 0, maxX-24, maxY-1); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		if _, err := g.SetCurrentView("input"); err != nil {
			return err
		}
		v.Editable = true
		v.Wrap = true
	}

	return nil
}
func layout(g *gocui.Gui) error {

	maxX, maxY := g.Size()
	v, err := g.SetView("mainmenu", 2, 1, maxX-2, maxY-2)

	v.FgColor = gocui.ColorGreen

	if err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		//		b, err := ioutil.ReadFile("mainmenu")
		//if err != nil {
		//	log.Panicln(err)
		//	panic(err)
		//}
		v.Title = "Main Menu"
		v.Frame = true
		//fmt.Fprintf(v, "%s", b)

		v.Wrap = true
		v.SetCursor(10, 10)
		fmt.Println(v.Cursor())
	}
	return nil

}
Exemple #4
0
func (runner *appRunner) layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()

	view, _ := g.SetView("mainControls", -1, -1, maxX/2, maxY)
	_, originY := view.Origin()
	_, cursorY := view.Cursor()

	view.Clear()
	runner.mainControlLines = 0
	runner.highlightedTexter = nil

	if g.CurrentView() == nil {
		g.SetCurrentView("mainControls")
	}
	view.Highlight = g.CurrentView() == view

	runner.rootTexter.TextMain(func(label, line string, texter ViewModelNodeTexter) {
		paddedLabel := fmt.Sprintf("%20s", label)
		fmt.Fprintf(view, "%s %v\n", paddedLabel[len(paddedLabel)-20:len(paddedLabel)], line)
		if (originY + cursorY) == runner.mainControlLines {
			runner.highlightedTexter = texter
		}
		runner.mainControlLines++
	})

	return nil
}
Exemple #5
0
func getLine(g *gocui.Gui, v *gocui.View) error {
	var l string
	var err error

	_, cy := v.Cursor()
	if l, err = v.Line(cy); err != nil {
		l = ""
	}

	maxX, maxY := g.Size()
	if v, err := g.SetView("msg", maxX/2-30, maxY/2, maxX/2+30, maxY/2+2); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(v, l)
		if err := g.SetCurrentView("msg"); err != nil {
			return err
		}
	}

	if v, err := g.View("main"); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		f := proj.GetFile(l)
		if f != nil {
			v.Clear()
			fmt.Fprintf(v, "%s", f.GetBody())
		}
		v.Editable = true
		v.Wrap = true
	}
	return nil
}
Exemple #6
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("side", -1, -1, 30, maxY); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.Highlight = true
		v.SelBgColor = gocui.ColorGreen
		v.SelFgColor = gocui.ColorBlack
		fmt.Fprintln(v, "Item 1")
		fmt.Fprintln(v, "Item 2")
		fmt.Fprintln(v, "Item 3")
		fmt.Fprint(v, "\rWill be")
		fmt.Fprint(v, "deleted\rItem 4\nItem 5")
	}
	if v, err := g.SetView("main", 30, -1, maxX, maxY); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		b, err := ioutil.ReadFile("Mark.Twain-Tom.Sawyer.txt")
		if err != nil {
			panic(err)
		}
		fmt.Fprintf(v, "%s", b)
		v.Editable = true
		v.Wrap = true
		if _, err := g.SetCurrentView("main"); err != nil {
			return err
		}
	}
	return nil
}
Exemple #7
0
func setDetailLayout(g *gocui.Gui) error {
	maxX, maxY := g.Size()

	summaryView, err := g.View("summary")
	if err != nil {
		return err
	}
	_, cy := summaryView.Cursor()
	_, oy := summaryView.Origin()
	currentCveInfo = cy + oy

	if v, err := g.SetView("detail", 40, int(float64(maxY)*0.2), maxX, maxY); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		//  text := report.ToPlainTextDetailsLangEn(
		//      currentScanResult.KnownCves[currentCveInfo],
		//      currentScanResult.Family)

		text, err := detailLines()
		if err != nil {
			return err
		}
		fmt.Fprint(v, text)
		v.Editable = false
		v.Wrap = true

		currentDetailLimitY = len(strings.Split(text, "\n")) - 1
	}
	return nil
}
Exemple #8
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	columnX := maxX / 3

	g.BgColor = gocui.ColorWhite
	g.FgColor = gocui.ColorBlack
	g.RenderFrames = false

	if v, err := g.SetView("status", -1, -1, maxX, 1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.FgColor = gocui.ColorWhite
		v.BgColor = gocui.ColorBlack
	}

	if v, err := g.SetView("counterHeader", -1, 0, columnX, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.FgColor = gocui.ColorWhite
		v.BgColor = gocui.ColorBlue
		fmt.Fprintf(v, "Counters")
	}
	if _, err := g.SetView("counters", -1, 1, columnX, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
	}

	if v, err := g.SetView("gaugeHeader", columnX, 0, columnX*2, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.FgColor = gocui.ColorWhite
		v.BgColor = gocui.ColorCyan
		fmt.Fprintf(v, "Gauges")
	}
	if _, err := g.SetView("gauges", columnX, 1, columnX*2, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
	}

	if v, err := g.SetView("timerHeader", columnX*2, 0, maxX-1, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.FgColor = gocui.ColorWhite
		v.BgColor = gocui.ColorMagenta
		fmt.Fprintf(v, "Timers")
	}
	if _, err := g.SetView("timers", (columnX * 2), 1, maxX-1, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
	}

	return nil
}
Exemple #9
0
func codeComplete(g *gocui.Gui, v *gocui.View) error {
	if v != nil {
		ox, oy := v.Origin()
		cx, cy := v.Cursor()

		x, y := ox+cx, oy+cy

		f := proj.GetFile("test.go")
		off := f.GetOffset(x, y)
		cands := codecomplete.Complete(proj, f, off)

		maxX, maxY := g.Size()
		maxY = maxY/2 - (len(cands) / 2)
		if v, err := g.SetView("msg", maxX/2-30, maxY, maxX/2+30, maxY+len(cands)+2); err != nil {
			if err != gocui.ErrorUnkView {
				return err
			}
			fmt.Fprintln(v, x, y, off)
			for _, c := range cands {
				fmt.Fprintln(v, c.Name, c.Perc)
			}

			if err := g.SetCurrentView("msg"); err != nil {
				return err
			}
		}
	}
	return nil
}
Exemple #10
0
func layout(g *gocui.Gui) error {
	theSizeX, theSizeY := 12, 6
	maxX, maxY := g.Size()
	centerX, centerY := maxX/2, maxY/2
	topLeftX, topLeftY := centerX-theSizeX, centerY-theSizeY
	bottomRightX, bottomRightY := centerX+theSizeX, centerY+theSizeY
	if v, err := g.SetView("yo", topLeftX, topLeftY, bottomRightX, bottomRightY); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.Editable = true
		v.Wrap = true
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " ---------------------")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " ---------------------")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
		fmt.Fprintln(v, " 1 2 3 | 4 5 6 | 7 8 9")
	}
	if err := g.SetCurrentView("yo"); err != nil {
		return err
	}
	return nil
}
Exemple #11
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("side", -1, -1, 30, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Highlight = true
		list := proj.GetFileList()
		for _, f := range list {
			fmt.Fprintln(v, filepath.Base(f.GetPath()))
		}
	}
	if v, err := g.SetView("main", 30, -1, maxX, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		f := proj.GetFile("test.go")
		if f != nil {
			fmt.Fprintf(v, "%s", f.GetBody())
		}
		v.Editable = true
		v.Wrap = false
		if err := g.SetCurrentView("main"); err != nil {
			return err
		}
	}
	return nil
}
Exemple #12
0
func newView(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	name := fmt.Sprintf("v%v", idxView)
	v, err := g.SetView(name, maxX/2-5, maxY/2-5, maxX/2+5, maxY/2+5)
	if err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Wrap = true
		fmt.Fprintln(v, strings.Repeat(name+" ", 30))
	}
	if err := g.SetCurrentView(name); err != nil {
		return err
	}
	v.BgColor = gocui.ColorRed

	if curView >= 0 {
		cv, err := g.View(views[curView])
		if err != nil {
			return err
		}
		cv.BgColor = g.BgColor
	}

	views = append(views, name)
	curView = len(views) - 1
	idxView += 1
	return nil
}
Exemple #13
0
func layout(g *gocui.Gui) error {
	var err error
	maxX, maxY := g.Size()
	if backgroundView, err = g.SetView("background", 0, 0, maxX, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
	}
	if profilePictureView, err = g.SetView("profilePicture", 1, 1, maxX-1, maxY-5); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		profilePictureView.Wrap = true
		fmt.Fprintln(profilePictureView, "Loading...")
	}
	if swipeLeftView, err = g.SetView("swipeLeft", 6, maxY-4, maxX/2-5, maxY-1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(swipeLeftView, "X")
	}
	if swipeRightView, err = g.SetView("swipeRight", maxX-(maxX/2-5), maxY-4, maxX-6, maxY-1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(swipeRightView, "<3")
	}
	if infoView, err = g.SetView("info", maxX/2-4, maxY-4, maxX/2+4, maxY-1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(infoView, "i")
	}
	return nil
}
Exemple #14
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	// main
	if v, err := g.SetView("main", -1, -1, maxX, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Wrap = true
		v.Autoscroll = true
	}
	// key bindings
	if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quitKey); err != nil {
		return err
	}
	// stats
	once.Do(func() {
		go func() {
			ticker := time.NewTicker(time.Second)

			for {
				select {
				case <-ticker.C:
					showUpdate()
				case <-stopChan:
					return
				}
			}
		}()
	})
	return nil
}
Exemple #15
0
func removeProject(g *gocui.Gui, v *gocui.View) error {
	var l string
	var err error

	g.ShowCursor = false

	_, cy := v.Cursor()
	if l, err = v.Line(cy); err != nil {
		l = ""
	}
	current_name = l

	maxX, maxY := g.Size()
	length := 20
	if l != "" {
		if v, err := g.SetView("del_proj", maxX/2-length/2, maxY/2, maxX/2+length/2, maxY/2+2); err != nil {
			v.BgColor = gocui.ColorRed
			if err != gocui.ErrorUnkView {
				return err
			}
			fmt.Fprintln(v, "Press 'd' to delete")
			setView(g, "del_proj")
		}
	}
	return nil
}
Exemple #16
0
func getLine(g *gocui.Gui, v *gocui.View) error {
	var l string
	var err error

	g.ShowCursor = false

	_, cy := v.Cursor()
	if l, err = v.Line(cy); err != nil {
		l = ""
	}

	maxX, maxY := g.Size()
	length := 10 + len(current_name)
	if l != "" {
		current_name = l
		if v, err := g.SetView("msg", maxX/2-length/2, maxY/2-3, maxX/2+length/2, maxY/2+3); err != nil {
			v.BgColor = gocui.ColorGreen
			v.FgColor = gocui.ColorBlack
			if err != gocui.ErrorUnkView {
				return err
			}
			current_proj = projects[current_name]
			current_proj.start()
			fmt.Fprintln(v, "")
			fmt.Fprintln(v, "")
			fmt.Fprintln(v, strings.Repeat(" ", (length-15)/2), "Active Project")
			fmt.Fprintln(v, "")
			fmt.Fprintln(v, strings.Repeat(" ", 5), current_name)
			fmt.Fprintln(v, "")
			setView(g, "msg")
		}
	}
	return nil
}
Exemple #17
0
func layout(g *ui.Gui) error {

	x, y := g.Size()
	size := len(cli.Nodes)

	if v, err := g.SetView("nodes-cursor", 0, 0, 6, size+1); err != nil {
		if err != ui.ErrUnknownView {
			return err
		}
		v.Highlight = true
		v.Frame = false
	}

	if v, err := g.SetView("nodes", 2, 0, 20, size+1); err != nil {
		if err != ui.ErrUnknownView {
			return err
		}
		v.Frame = false
		printNodes()
	}

	if v, err := g.SetView("node", 16, 0, x, y-1); err != nil {
		if err != ui.ErrUnknownView {
			return err
		}
		v.Frame = false
		v.Editable = true
		printNode(g)
	}
	return g.SetCurrentView(current)
}
Exemple #18
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("side", -1, -1, 30, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Highlight = true
		fmt.Fprintln(v, "Item 1")
		fmt.Fprintln(v, "Item 2")
		fmt.Fprintln(v, "Item 3")
		fmt.Fprintln(v, "Item 4")
	}
	if v, err := g.SetView("main", 30, -1, maxX, maxY); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		b, err := ioutil.ReadFile("Mark.Twain-Tom.Sawyer.txt")
		if err != nil {
			panic(err)
		}
		fmt.Fprintf(v, "%s", b)
		v.Editable = true
		if err := g.SetCurrentView("main"); err != nil {
			return err
		}
	}
	return nil
}
Exemple #19
0
func layout(g *gocui.Gui) error {
	maxX, _ := g.Size()

	if v, err := g.SetView("legend", maxX-23, 0, maxX-1, 5); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		fmt.Fprintln(v, "KEYBINDINGS")
		fmt.Fprintln(v, "↑ ↓: Seek input")
		fmt.Fprintln(v, "A: Enable autoscroll")
		fmt.Fprintln(v, "^C: Exit")
	}

	if v, err := g.SetView("stdin", 0, 0, 80, 35); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		if _, err := g.SetCurrentView("stdin"); err != nil {
			return err
		}
		dumper := hex.Dumper(v)
		if _, err := io.Copy(dumper, os.Stdin); err != nil {
			return err
		}
		v.Wrap = true
	}

	return nil
}
Exemple #20
0
func setLayout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("tubes", 0, 0, maxX-1, maxY-3); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}

		//Initialise the view settings
		v.Highlight = true
		v.Wrap = true
		v.Editable = false
		v.Autoscroll = false

		PrintTubeList(v)

		//Move the cursor to the first tube
		if err = MoveTubeCursor(g, 0, 1); err != nil {
			return err
		}
	}

	if v, err := g.SetView("menu", 0, maxY-3, maxX-1, maxY-1); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}

		PrintMenu(v)
	}

	return nil
}
Exemple #21
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if _, err := g.SetView("main", -1, -1, maxX, maxY); err != nil {
		if err := g.SetCurrentView("main"); err != nil {
			return err
		}
	}
	return nil
}
Exemple #22
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		fmt.Fprintln(v, "Hello world!")
	}
	return nil
}
Exemple #23
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("center", maxX/2-10, maxY/2, maxX/2+10, maxY/2+2); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		fmt.Fprintln(v, "This is an example")
	}
	return nil
}
Exemple #24
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()

	if v, err := g.SetView("info", maxX-53, 9, maxX-1, maxY-4); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(v, " PROJECT INFORMATION")
	}

	if v, err := g.SetView("list", 0, 1, maxX-54, maxY-1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		v.Highlight = true
		for k, _ := range projects {
			fmt.Fprintln(v, k)
		}
		setView(g, "list")
		if l := len(projects); l != 0 {
			_, cy := v.Cursor()
			if current_name, err = v.Line(cy); err != nil {
				current_name = ""
			}
			updateProjInfo(g, v)
		}
	}

	if v, err := g.SetView("legend", maxX-53, 1, maxX-1, 8); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(v, " KEYBINDINGS")
		fmt.Fprintln(v, " A: Add new project")
		fmt.Fprintln(v, " D: Delete a project")
		fmt.Fprintln(v, " Enter: Activate a project")
		fmt.Fprintln(v, " ^C: Exit")
	}

	if v, err := g.SetView("label", maxX-53, maxY-3, maxX-1, maxY-1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(v, " This is go-watch -- a time tracker")
	}
	if v, err := g.SetView("listlabel", 0, -1, 20, 1); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(v, "LIST OF PROJECTS")
		v.Frame = false
	}

	return nil
}
Exemple #25
0
func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	maxY = maxY - 1

	const channelsWidth = 30
	const inputHeight = 1
	const messageNamesWidth = 20 // TODO(dynamically get widest name?)

	// the -1 everywhere is subtracting borders

	log.Println("DEBUG setting view")
	if v, err := g.SetView("channels", 0, 0, channelsWidth-1, maxY-inputHeight); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.SelFgColor = gocui.AttrReverse
		v.SelBgColor = gocui.AttrReverse
		//		v.SelFgColor = gocui.ColorGreen | gocui.AttrBold
		//		v.SelBgColor = gocui.ColorBlack | gocui.AttrBold
		v.Highlight = true
	}

	//	messagesWidth := maxX - channelsWidth
	if v, err := g.SetView("messages-names", channelsWidth, 0, channelsWidth+messageNamesWidth, maxY-inputHeight); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.FgColor = gocui.ColorRed | gocui.AttrBold
		v.BgColor = gocui.ColorBlack | gocui.AttrBold
		v.Highlight = false
		v.Frame = false
	}

	if v, err := g.SetView("messages", channelsWidth+messageNamesWidth, 0, maxX-1, maxY-inputHeight); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.Frame = false
	}

	if v, err := g.SetView("input", 0, maxY-inputHeight-1, maxX-1, maxY); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.Editable = true
		v.Autoscroll = true
		v.Wrap = true
		v.SetCursor(0, 0)
		v.SetOrigin(0, 0)
	}

	return nil
}
Exemple #26
0
func addProject(g *gocui.Gui, v *gocui.View) error {
	g.ShowCursor = true
	maxX, maxY := g.Size()
	if v, err := g.SetView("save_proj", maxX/2-30, maxY/2, maxX/2+30, maxY/2+2); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		setView(g, "save_proj")
		v.Editable = true
	}
	return nil
}
func message(g *gocui.Gui, text string) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView(vMessage, maxX/2-30, maxY/2, maxX/2+30, maxY/2+2); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		fmt.Fprintln(v, text)
		if err := g.SetCurrentView(vMessage); err != nil {
			return err
		}
	}
	return nil
}
Exemple #28
0
func CreateCommentView(g *gocui.Gui, i *issueComment) (*commentView, error) {
	c := &commentView{
		ic: i,
	}
	maxX, maxY := g.Size()
	_, err := g.SetView(c.viewName(), 4, 4, maxX-4, maxY-4)
	if err != gocui.ErrorUnkView {
		return nil, err
	}
	debug = *i.issue.URL

	return c, c.updateView(g)
}
Exemple #29
0
func showMatched(g *gocui.Gui, v *gocui.View) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("matched", maxX/2-8, maxY/2, maxX/2+8, maxY/2+2); err != nil {
		if err != gocui.ErrorUnkView {
			return err
		}
		fmt.Fprintln(v, "Matched!")
		if err := g.SetCurrentView("matched"); err != nil {
			return err
		}
	}
	return nil
}
Exemple #30
0
func layout(g *gocui.Gui) error {
	_, maxY := g.Size()
	if v, err := g.SetView("main", 0, 0, 20, maxY-1); err != nil {
		if err != gocui.ErrUnknownView {
			return err
		}
		v.Editable = true
		v.Wrap = true
		if _, err := g.SetCurrentView("main"); err != nil {
			return err
		}
	}
	return nil
}