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

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

* feat(table): implement help.Keymap interface and add quit mapping
This commit is contained in:
Maciej Więcek
2024-02-28 14:12:37 -05:00
committed by GitHub
parent 9d9d5ad2bc
commit 9ffcdc06a0
+13
View File
@@ -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 = " "