Skip to content

Commit

Permalink
feat(table): implement help.Keymap interface and add quit mapping (ch…
Browse files Browse the repository at this point in the history
…armbracelet#440)

* feat(table): implement help.Keymap interface and add quit mapping

* feat(table): implement help.Keymap interface and add quit mapping
  • Loading branch information
prgres authored Feb 28, 2024
1 parent 1631674 commit 842ee7a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ type KeyMap struct {
GotoBottom key.Binding
}

// ShortHelp implements the KeyMap interface.
func (km KeyMap) ShortHelp() []key.Binding {
return []key.Binding{km.LineUp, km.LineDown}
}

// FullHelp implements the KeyMap interface.
func (km KeyMap) FullHelp() [][]key.Binding {
return [][]key.Binding{
{km.LineUp, km.LineDown, km.GotoTop, km.GotoBottom},
{km.PageUp, km.PageDown, km.HalfPageUp, km.HalfPageDown},
}
}

// DefaultKeyMap returns a default set of keybindings.
func DefaultKeyMap() KeyMap {
const spacebar = " "
Expand Down

0 comments on commit 842ee7a

Please sign in to comment.