func onPrevPanel(ui *UI, wrap bool) Fn {
	return func(*gocui.Gui, *gocui.View) error {
		return ui.prevView(wrap)
	}
}
onPrevPanel retrieves the previous panel.
package ui
import (
	"bytes"
	"fmt"
	"log"
	"path/filepath"
	"runtime"
	"text/tabwriter"
	"github.com/esimov/diagram/io"
	"github.com/jroimartin/gocui"
)
type Fn func(*gocui.Gui, *gocui.View) error
type handler struct {
	views   []string
	key     interface{}
	keyName string
	help    string
	action  func(*UI, bool) Fn
}
type handlers []handler
var keyHandlers = &handlers{
	{mainViews, gocui.KeyTab, "Tab", "Next Panel", onNextPanel},
	{mainViews, 0xFF, "Shift+Tab", "Previous Panel", nil},
	{nil, gocui.KeyPgup, "PgUp", "Jump to the top", nil},
	{nil, gocui.KeyPgdn, "PgDown", "Jump to the bottom", nil},
	{nil, gocui.KeyHome, "Home", "Jump to the start", nil},
	{nil, gocui.KeyEnd, "End", "Jump to the end", nil},
	*getDeleteHandler(),
	{nil, gocui.KeyCtrlX, "Ctrl+x", "Clear editor content", nil},
	{nil, gocui.KeyCtrlZ, "Ctrl+z", "Restore editor content", nil},
	{nil, gocui.KeyCtrlS, "Ctrl+s", "Save diagram", onSaveDiagram},
	{nil, gocui.KeyCtrlD, "Ctrl+d", "Draw diagram", onDrawDiagram},
	{nil, gocui.KeyCtrlC, "Ctrl+c", "Quit", onQuit},
}
func getDeleteHandler() *handler {
	if runtime.GOOS == "Darwin" {
		return &handler{nil, gocui.KeyBackspace2, "Backspace", "Delete diagram", nil}
	}
	return &handler{nil, gocui.KeyDelete, "Delete", "Delete diagram", nil}
}
func onNextPanel(ui *UI, wrap bool) Fn {
	return func(*gocui.Gui, *gocui.View) error {
		return ui.nextView(wrap)
	}
}