From a8bb645db19661f8fb85a5a5ef72b27cfd8d0bc2 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 31 Oct 2024 13:57:17 -0400 Subject: [PATCH] feat!(paginator): DefaultKeyMap is now a func instead of a global --- paginator/paginator.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/paginator/paginator.go b/paginator/paginator.go index ecdbf583..1fea948b 100644 --- a/paginator/paginator.go +++ b/paginator/paginator.go @@ -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. @@ -129,7 +131,7 @@ func New(opts ...Option) Model { Page: 0, PerPage: 1, TotalPages: 1, - KeyMap: DefaultKeyMap, + KeyMap: DefaultKeyMap(), ActiveDot: "•", InactiveDot: "○", ArabicFormat: "%d/%d",