-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feature): add a toggleable view mode to the table panel (#34)
Signed-off-by: Bryce Palmer <[email protected]>
- Loading branch information
1 parent
451ebd3
commit 8ac4411
Showing
6 changed files
with
310 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package models | ||
|
||
import ( | ||
"github.com/charmbracelet/bubbles/help" | ||
"github.com/charmbracelet/bubbles/key" | ||
) | ||
|
||
type CompositeHelpKeyMap struct { | ||
helps []help.KeyMap | ||
} | ||
|
||
func NewCompositeHelpKeyMap(helps ...help.KeyMap) *CompositeHelpKeyMap { | ||
return &CompositeHelpKeyMap{helps: helps} | ||
} | ||
|
||
// ShortHelp returns keybindings to be shown in the mini help view. It's part | ||
// of the key.Map interface. | ||
func (ch CompositeHelpKeyMap) ShortHelp() []key.Binding { | ||
bindings := []key.Binding{} | ||
for _, h := range ch.helps { | ||
bindings = append(bindings, h.ShortHelp()...) | ||
} | ||
return bindings | ||
} | ||
|
||
// FullHelp returns keybindings for the expanded help view. It's part of the | ||
// key.Map interface. | ||
func (ch CompositeHelpKeyMap) FullHelp() [][]key.Binding { | ||
bindings := [][]key.Binding{} | ||
for _, h := range ch.helps { | ||
bindings = append(bindings, h.FullHelp()...) | ||
} | ||
return bindings | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.