Skip to content

Commit

Permalink
feat!(paginator): DefaultKeyMap is now a func instead of a global
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Oct 31, 2024
1 parent 6925a58 commit a8bb645
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions paginator/paginator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ type KeyMap struct {

// DefaultKeyMap is the default set of key bindings for navigating and acting
// upon the paginator.
var DefaultKeyMap = KeyMap{
PrevPage: key.NewBinding(key.WithKeys("pgup", "left", "h")),
NextPage: key.NewBinding(key.WithKeys("pgdown", "right", "l")),
func DefaultKeyMap() KeyMap {
return KeyMap{
PrevPage: key.NewBinding(key.WithKeys("pgup", "left", "h")),
NextPage: key.NewBinding(key.WithKeys("pgdown", "right", "l")),
}
}

// Model is the Bubble Tea model for this user interface.
Expand Down Expand Up @@ -129,7 +131,7 @@ func New(opts ...Option) Model {
Page: 0,
PerPage: 1,
TotalPages: 1,
KeyMap: DefaultKeyMap,
KeyMap: DefaultKeyMap(),
ActiveDot: "•",
InactiveDot: "○",
ArabicFormat: "%d/%d",
Expand Down

0 comments on commit a8bb645

Please sign in to comment.