Documentation ¶
Index ¶
- Variables
- func AddHandler(hnd KeyHandler)
- func Bind(g *gocui.Gui) error
- func GetKeyBindingsAsStrings() map[string]string
- type ClearPendingDeleteHandler
- type ConfirmDeleteHandler
- type CopyHandler
- type FullscreenHandler
- type GlobalHandler
- type HelpHandler
- type ItemBackHandler
- type ItemHandler
- type ItemLeftHandler
- type ItemViewPageDownHandler
- type ItemViewPageUpHandler
- type KeyHandler
- type KeyHandlerBase
- type KeyMap
- type ListActionsHandler
- type ListBackHandler
- type ListBackLegacyHandler
- type ListDeleteHandler
- type ListDownHandler
- type ListEditHandler
- type ListEndHandler
- type ListExpandHandler
- type ListHandler
- type ListHomeHandler
- type ListOpenHandler
- type ListPageDownHandler
- type ListPageUpHandler
- type ListRefreshHandler
- type ListRightHandler
- type ListUpHandler
- type ListUpdateHandler
- type QuitHandler
Constants ¶
This section is empty.
Variables ¶
var DefaultKeys = map[string]gocui.Key{ "quit": gocui.KeyCtrlC, "copy": gocui.KeyCtrlS, "listdelete": gocui.KeyDelete, "fullscreen": gocui.KeyCtrlF, "help": gocui.KeyCtrlI, "itemback": gocui.KeyBackspace2, "itemleft": gocui.KeyArrowLeft, "listactions": gocui.KeyCtrlA, "listback": gocui.KeyBackspace2, "listbacklegacy": gocui.KeyBackspace, "listdown": gocui.KeyArrowDown, "listup": gocui.KeyArrowUp, "listright": gocui.KeyArrowRight, "listedit": gocui.KeyCtrlE, "listexpand": gocui.KeyEnter, "listopen": gocui.KeyCtrlO, "listrefresh": gocui.KeyF5, "listupdate": gocui.KeyCtrlU, "listpagedown": gocui.KeyPgdn, "listpageup": gocui.KeyPgup, "listend": gocui.KeyEnd, "listhome": gocui.KeyHome, "confirmdelete": gocui.KeyCtrlY, "clearpendingdeletes": gocui.KeyCtrlN, "itempagedown": gocui.KeyPgdn, "itempageup": gocui.KeyPgup, }
DefaultKeys are the default key bindings for each handler.
var HandlerIds = []string{
"quit",
"copy",
"listdelete",
"fullscreen",
"help",
"itemback",
"itemleft",
"listactions",
"listback",
"listbacklegacy",
"listdown",
"listup",
"listright",
"listedit",
"listexpand",
"listopen",
"listrefresh",
"listupdate",
"listpagedown",
"listpageup",
"listend",
"listhome",
"confirmdelete",
"clearpendingdeletes",
"itempagedown",
"itempageup",
}
HandlerIds A list of available handlers and their associated array index
var KeyToStr = map[gocui.Key]string{ gocui.KeyArrowUp: "up", gocui.KeyArrowDown: "down", gocui.KeyArrowLeft: "left", gocui.KeyArrowRight: "right", gocui.KeyDelete: "delete", gocui.KeyHome: "home", gocui.KeyEnd: "end", gocui.KeyPgup: "pageup", gocui.KeyPgdn: "pagedown", gocui.KeyInsert: "insert", gocui.KeySpace: "space", gocui.KeyCtrl2: "ctrl+2 or ctrl+~ or ctrl+space", gocui.KeyCtrl4: "ctrl+4", gocui.KeyCtrl6: "ctrl+6", gocui.KeyCtrl8: "ctrl+8 or backspace2", gocui.KeyCtrlLsqBracket: "ctrl+[ or esc or ctrl+3", gocui.KeyCtrlRsqBracket: "ctrl+] or ctrl+5", gocui.KeyCtrlUnderscore: "ctrl+_ or ctrl+7", gocui.KeyCtrlA: "ctrl+a", gocui.KeyCtrlB: "ctrl+b", gocui.KeyCtrlC: "ctrl+c", gocui.KeyCtrlD: "ctrl+d", gocui.KeyCtrlE: "ctrl+e", gocui.KeyCtrlF: "ctrl+f", gocui.KeyCtrlG: "ctrl+g", gocui.KeyCtrlH: "ctrl+h or ctrl+backspace", gocui.KeyCtrlI: "ctrl+i or tab", gocui.KeyCtrlJ: "ctrl+j", gocui.KeyCtrlK: "ctrl+k", gocui.KeyCtrlL: "ctrl+l", gocui.KeyCtrlM: "enter or ctrl+m", gocui.KeyCtrlN: "ctrl+n", gocui.KeyCtrlO: "ctrl+o", gocui.KeyCtrlP: "ctrl+p", gocui.KeyCtrlQ: "ctrl+q", gocui.KeyCtrlR: "ctrl+r", gocui.KeyCtrlS: "ctrl+s", gocui.KeyCtrlT: "ctrl+t", gocui.KeyCtrlU: "ctrl+u", gocui.KeyCtrlV: "ctrl+v", gocui.KeyCtrlW: "ctrl+w", gocui.KeyCtrlX: "ctrl+x", gocui.KeyCtrlY: "ctrl+y", gocui.KeyCtrlZ: "ctrl+z", gocui.KeyF1: "f1", gocui.KeyF2: "f2", gocui.KeyF3: "f3", gocui.KeyF4: "f4", gocui.KeyF5: "f5", gocui.KeyF6: "f6", gocui.KeyF7: "f7", gocui.KeyF8: "f8", gocui.KeyF9: "f9", gocui.KeyF10: "f10", gocui.KeyF11: "f11", gocui.KeyF12: "f12", }
KeyToStr maps a gocui key to a string
var StrToKey = map[string]gocui.Key{ "up": gocui.KeyArrowUp, "down": gocui.KeyArrowDown, "left": gocui.KeyArrowLeft, "right": gocui.KeyArrowRight, "backspace": gocui.KeyBackspace, "backspace2": gocui.KeyBackspace2, "delete": gocui.KeyDelete, "home": gocui.KeyHome, "end": gocui.KeyEnd, "pageup": gocui.KeyPgup, "pagedown": gocui.KeyPgdn, "insert": gocui.KeyInsert, "tab": gocui.KeyTab, "space": gocui.KeySpace, "ctrl+2": gocui.KeyCtrl2, "ctrl+3": gocui.KeyCtrl3, "ctrl+4": gocui.KeyCtrl4, "ctrl+5": gocui.KeyCtrl5, "ctrl+6": gocui.KeyCtrl6, "ctrl+7": gocui.KeyCtrl7, "ctrl+8": gocui.KeyCtrl8, "ctrl+[": gocui.KeyCtrlLsqBracket, "ctrl+]": gocui.KeyCtrlRsqBracket, "ctrl+space": gocui.KeyCtrlSpace, "ctrl+_": gocui.KeyCtrlUnderscore, "ctrl+~": gocui.KeyCtrlTilde, "ctrl+a": gocui.KeyCtrlA, "ctrl+b": gocui.KeyCtrlB, "ctrl+c": gocui.KeyCtrlC, "ctrl+d": gocui.KeyCtrlD, "ctrl+e": gocui.KeyCtrlE, "ctrl+f": gocui.KeyCtrlF, "ctrl+g": gocui.KeyCtrlG, "ctrl+h": gocui.KeyCtrlH, "ctrl+i": gocui.KeyCtrlI, "ctrl+j": gocui.KeyCtrlJ, "ctrl+k": gocui.KeyCtrlK, "ctrl+l": gocui.KeyCtrlL, "ctrl+m": gocui.KeyCtrlM, "ctrl+n": gocui.KeyCtrlN, "ctrl+o": gocui.KeyCtrlO, "ctrl+p": gocui.KeyCtrlP, "ctrl+q": gocui.KeyCtrlQ, "ctrl+r": gocui.KeyCtrlR, "ctrl+s": gocui.KeyCtrlS, "ctrl+t": gocui.KeyCtrlT, "ctrl+u": gocui.KeyCtrlU, "ctrl+v": gocui.KeyCtrlV, "ctrl+w": gocui.KeyCtrlW, "ctrl+x": gocui.KeyCtrlX, "ctrl+y": gocui.KeyCtrlY, "ctrl+z": gocui.KeyCtrlZ, "esc": gocui.KeyEsc, "f1": gocui.KeyF1, "f2": gocui.KeyF2, "f3": gocui.KeyF3, "f4": gocui.KeyF4, "f5": gocui.KeyF5, "f6": gocui.KeyF6, "f7": gocui.KeyF7, "f8": gocui.KeyF8, "f9": gocui.KeyF9, "f10": gocui.KeyF10, "f11": gocui.KeyF11, "f12": gocui.KeyF12, "enter": gocui.KeyEnter, }
StrToKey maps a string representing they key to a gocui key
Functions ¶
func AddHandler ¶
func AddHandler(hnd KeyHandler)
AddHandler Adds a keybinding handler for use in Bind
func GetKeyBindingsAsStrings ¶
GetKeyBindingsAsStrings provides a map of Handler->Key in string format
Types ¶
type ClearPendingDeleteHandler ¶ added in v1.1.170
type ClearPendingDeleteHandler struct { GlobalHandler // contains filtered or unexported fields }
//////////////////////////////////////////////////////////////////
func NewClearPendingDeleteHandler ¶ added in v1.1.170
func NewClearPendingDeleteHandler(notificationWidget *views.NotificationWidget) *ClearPendingDeleteHandler
type ConfirmDeleteHandler ¶ added in v1.1.170
type ConfirmDeleteHandler struct { GlobalHandler // contains filtered or unexported fields }
//////////////////////////////////////////////////////////////////
func NewConfirmDeleteHandler ¶ added in v1.1.170
func NewConfirmDeleteHandler(notificationWidget *views.NotificationWidget) *ConfirmDeleteHandler
type CopyHandler ¶
type CopyHandler struct { GlobalHandler Content *views.ItemWidget StatusBar *views.StatusbarWidget }
//////////////////////////////////////////////////////////////////
func NewCopyHandler ¶
func NewCopyHandler(content *views.ItemWidget, statusbar *views.StatusbarWidget) *CopyHandler
type FullscreenHandler ¶
type FullscreenHandler struct { GlobalHandler List *views.ListWidget IsFullscreen *bool Content *views.ItemWidget }
//////////////////////////////////////////////////////////////////
func NewFullscreenHandler ¶
func NewFullscreenHandler(list *views.ListWidget, content *views.ItemWidget, isFullscreen *bool) *FullscreenHandler
type GlobalHandler ¶
type GlobalHandler struct {
KeyHandlerBase
}
GlobalHandler is a parent struct for all key handlers not tied to a specific view.
func (GlobalHandler) Widget ¶
func (h GlobalHandler) Widget() string
Widget returns the name of the widget this handler binds to
type HelpHandler ¶
type HelpHandler struct { GlobalHandler ShowHelp *bool }
//////////////////////////////////////////////////////////////////
func NewHelpHandler ¶
func NewHelpHandler(showHelp *bool) *HelpHandler
type ItemBackHandler ¶
type ItemBackHandler struct { ItemHandler List *views.ListWidget }
//////////////////////////////////////////////////////////////////
func NewItemBackHandler ¶
func NewItemBackHandler(list *views.ListWidget) *ItemBackHandler
type ItemHandler ¶
type ItemHandler struct {
KeyHandlerBase
}
ItemHandler is a parent struct for all key handlers tied to the item widget view
func (ItemHandler) Widget ¶
func (h ItemHandler) Widget() string
Widget returns the name of the widget this handler binds to
type ItemLeftHandler ¶
type ItemLeftHandler struct { ItemHandler EditModeEnabled *bool }
//////////////////////////////////////////////////////////////////
func NewItemLeftHandler ¶
func NewItemLeftHandler(editModeEnabled *bool) *ItemLeftHandler
type ItemViewPageDownHandler ¶ added in v1.1.251
type ItemViewPageDownHandler struct { ItemHandler ItemView *views.ItemWidget }
//////////////////////////////////////////////////////////////////
func NewItemViewPageDownHandler ¶ added in v1.1.251
func NewItemViewPageDownHandler(itemView *views.ItemWidget) *ItemViewPageDownHandler
type ItemViewPageUpHandler ¶ added in v1.1.251
type ItemViewPageUpHandler struct { ItemHandler ItemView *views.ItemWidget }
//////////////////////////////////////////////////////////////////
func NewItemViewPageUpHandler ¶ added in v1.1.251
func NewItemViewPageUpHandler(itemView *views.ItemWidget) *ItemViewPageUpHandler
type KeyHandler ¶
type KeyHandler interface { ID() string Fn() func(g *gocui.Gui, v *gocui.View) error Widget() string DefaultKey() gocui.Key }
KeyHandler is an interface that all key handlers must implement
type KeyHandlerBase ¶
type KeyHandlerBase struct {
Index uint16
}
KeyHandlerBase A base structure that will return the associated handler id from the HandlersId array and a default key for the handler.
func (KeyHandlerBase) DefaultKey ¶
func (h KeyHandlerBase) DefaultKey() gocui.Key
DefaultKey returns the default key mapped to the handler
func (KeyHandlerBase) ID ¶ added in v1.1.50
func (h KeyHandlerBase) ID() string
ID returns the name of this item for example "listup"
type ListActionsHandler ¶
type ListActionsHandler struct { ListHandler List *views.ListWidget Context context.Context }
//////////////////////////////////////////////////////////////////
func NewListActionsHandler ¶
func NewListActionsHandler(list *views.ListWidget, context context.Context) *ListActionsHandler
type ListBackHandler ¶
type ListBackHandler struct { ListHandler List *views.ListWidget }
//////////////////////////////////////////////////////////////////
func NewListBackHandler ¶
func NewListBackHandler(list *views.ListWidget) *ListBackHandler
type ListBackLegacyHandler ¶
type ListBackLegacyHandler struct { ListHandler List *views.ListWidget }
//////////////////////////////////////////////////////////////////
func NewListBackLegacyHandler ¶
func NewListBackLegacyHandler(list *views.ListWidget) *ListBackLegacyHandler
type ListDeleteHandler ¶
type ListDeleteHandler struct { ListHandler List *views.ListWidget NotificationWidget *views.NotificationWidget }
//////////////////////////////////////////////////////////////////
func NewListDeleteHandler ¶
func NewListDeleteHandler(list *views.ListWidget, notificationWidget *views.NotificationWidget) *ListDeleteHandler
type ListDownHandler ¶
type ListDownHandler struct { ListHandler List *views.ListWidget }
//////////////////////////////////////////////////////////////////
func NewListDownHandler ¶
func NewListDownHandler(list *views.ListWidget) *ListDownHandler
type ListEditHandler ¶
type ListEditHandler struct { ListHandler List *views.ListWidget EditModeEnabled *bool }
//////////////////////////////////////////////////////////////////
func NewListEditHandler ¶
func NewListEditHandler(list *views.ListWidget, editModeEnabled *bool) *ListEditHandler
type ListEndHandler ¶ added in v1.1.104
type ListEndHandler struct { ListHandler List *views.ListWidget }
/////////////////////////////////////////////////////////////////
func NewListEndHandler ¶ added in v1.1.104
func NewListEndHandler(list *views.ListWidget) *ListEndHandler
type ListExpandHandler ¶
type ListExpandHandler struct { ListHandler List *views.ListWidget }
//////////////////////////////////////////////////////////////////
func NewListExpandHandler ¶
func NewListExpandHandler(list *views.ListWidget) *ListExpandHandler
type ListHandler ¶
type ListHandler struct {
KeyHandlerBase
}
ListHandler is a parent struct for all key handlers tied to the list widget view
func (ListHandler) Widget ¶
func (h ListHandler) Widget() string
Widget returns the name of the widget this handler binds to
type ListHomeHandler ¶ added in v1.1.104
type ListHomeHandler struct { ListHandler List *views.ListWidget }
/////////////////////////////////////////////////////////////////
func NewListHomeHandler ¶ added in v1.1.104
func NewListHomeHandler(list *views.ListWidget) *ListHomeHandler
type ListOpenHandler ¶
type ListOpenHandler struct { ListHandler List *views.ListWidget Context context.Context }
//////////////////////////////////////////////////////////////////
func NewListOpenHandler ¶
func NewListOpenHandler(list *views.ListWidget, context context.Context) *ListOpenHandler
type ListPageDownHandler ¶ added in v1.1.104
type ListPageDownHandler struct { ListHandler List *views.ListWidget }
/////////////////////////////////////////////////////////////////
func NewListPageDownHandler ¶ added in v1.1.104
func NewListPageDownHandler(list *views.ListWidget) *ListPageDownHandler
type ListPageUpHandler ¶ added in v1.1.104
type ListPageUpHandler struct { ListHandler List *views.ListWidget }
/////////////////////////////////////////////////////////////////
func NewListPageUpHandler ¶ added in v1.1.104
func NewListPageUpHandler(list *views.ListWidget) *ListPageUpHandler
type ListRefreshHandler ¶
type ListRefreshHandler struct { ListHandler List *views.ListWidget }
//////////////////////////////////////////////////////////////////
func NewListRefreshHandler ¶
func NewListRefreshHandler(list *views.ListWidget) *ListRefreshHandler
type ListRightHandler ¶
type ListRightHandler struct { ListHandler List *views.ListWidget EditModeEnabled *bool }
//////////////////////////////////////////////////////////////////
func NewListRightHandler ¶
func NewListRightHandler(list *views.ListWidget, editModeEnabled *bool) *ListRightHandler
type ListUpHandler ¶
type ListUpHandler struct { ListHandler List *views.ListWidget }
//////////////////////////////////////////////////////////////////
func NewListUpHandler ¶
func NewListUpHandler(list *views.ListWidget) *ListUpHandler
type ListUpdateHandler ¶
type ListUpdateHandler struct { ListHandler List *views.ListWidget Context context.Context Content *views.ItemWidget // contains filtered or unexported fields }
//////////////////////////////////////////////////////////////////
func NewListUpdateHandler ¶
func NewListUpdateHandler(list *views.ListWidget, statusbar *views.StatusbarWidget, ctx context.Context, content *views.ItemWidget) *ListUpdateHandler
type QuitHandler ¶
type QuitHandler struct {
GlobalHandler
}
//////////////////////////////////////////////////////////////////
func NewQuitHandler ¶
func NewQuitHandler() *QuitHandler