From 9ffcdc06a0228c36bd489d43e76ef07200953c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Wi=C4=99cek?= Date: Wed, 28 Feb 2024 20:12:37 +0100 Subject: [PATCH] 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 --- table/table.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/table/table.go b/table/table.go index fcb9011..3ecb94b 100644 --- a/table/table.go +++ b/table/table.go @@ -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 = " "