From 3521ebf6e88ea4fe85adcd94a9275c0b3aaa040a Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Thu, 26 Nov 2020 23:06:48 -0800 Subject: [PATCH] Rename SigilStr to PaginationMarker Signed-off-by: Chris Cummer --- cfg/common_settings.go | 4 +++- cfg/common_settings_test.go | 4 ++-- modules/cds/favorites/display.go | 2 +- modules/cds/queue/display.go | 2 +- modules/gerrit/display.go | 2 +- modules/git/display.go | 2 +- modules/github/display.go | 2 +- modules/gitlab/display.go | 2 +- modules/mercurial/display.go | 2 +- modules/textfile/widget.go | 2 +- modules/twitter/widget.go | 2 +- modules/weatherservices/weather/display.go | 2 +- 12 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cfg/common_settings.go b/cfg/common_settings.go index 1d8b6e8e..2e00251c 100644 --- a/cfg/common_settings.go +++ b/cfg/common_settings.go @@ -151,7 +151,9 @@ func (common *Common) RightAlignFormat(width int) string { return fmt.Sprintf("%%%ds", width-borderOffset) } -func (common *Common) SigilStr(len, pos, width int) string { +// PaginationMarker generates the pagination indicators that appear in the top-right corner +// of multisource widgets +func (common *Common) PaginationMarker(len, pos, width int) string { sigils := "" if len > 1 { diff --git a/cfg/common_settings_test.go b/cfg/common_settings_test.go index db1e82b5..9ac1ef1f 100644 --- a/cfg/common_settings_test.go +++ b/cfg/common_settings_test.go @@ -144,7 +144,7 @@ func Test_RightAlignFormat(t *testing.T) { } } -func Test_SigilStr(t *testing.T) { +func Test_PaginationMarker(t *testing.T) { tests := []struct { name string len int @@ -184,7 +184,7 @@ func Test_SigilStr(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, tt.expected, testCfg.SigilStr(tt.len, tt.pos, tt.width)) + assert.Equal(t, tt.expected, testCfg.PaginationMarker(tt.len, tt.pos, tt.width)) }) } } diff --git a/modules/cds/favorites/display.go b/modules/cds/favorites/display.go index 938f4883..095343a7 100644 --- a/modules/cds/favorites/display.go +++ b/modules/cds/favorites/display.go @@ -25,7 +25,7 @@ func (widget *Widget) content() (string, string, bool) { } _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.workflows), widget.Idx, width) + "\n" + str := widget.settings.common.PaginationMarker(len(widget.workflows), widget.Idx, width) + "\n" title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(workflow)) str += widget.displayWorkflowRuns(workflow) diff --git a/modules/cds/queue/display.go b/modules/cds/queue/display.go index 9275c9f0..6d2c8fd4 100644 --- a/modules/cds/queue/display.go +++ b/modules/cds/queue/display.go @@ -23,7 +23,7 @@ func (widget *Widget) content() (string, string, bool) { filter := widget.currentFilter() _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.filters), widget.Idx, width) + "\n" + str := widget.settings.common.PaginationMarker(len(widget.filters), widget.Idx, width) + "\n" str += widget.displayQueue(filter) title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(filter)) diff --git a/modules/gerrit/display.go b/modules/gerrit/display.go index 1444c690..2572692c 100644 --- a/modules/gerrit/display.go +++ b/modules/gerrit/display.go @@ -22,7 +22,7 @@ func (widget *Widget) content() (string, string, bool) { title = fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project)) _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.GerritProjects), widget.Idx, width) + "\n" + str := widget.settings.common.PaginationMarker(len(widget.GerritProjects), widget.Idx, width) + "\n" str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading) str += widget.displayStats(project) str += "\n" diff --git a/modules/git/display.go b/modules/git/display.go index 25c62e59..8fc44741 100644 --- a/modules/git/display.go +++ b/modules/git/display.go @@ -23,7 +23,7 @@ func (widget *Widget) content() (string, string, bool) { ) _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.GitRepos), widget.Idx, width) + "\n" + str := widget.settings.common.PaginationMarker(len(widget.GitRepos), widget.Idx, width) + "\n" str += fmt.Sprintf(" [%s]Branch[white]\n", widget.settings.common.Colors.Subheading) str += fmt.Sprintf(" %s", repoData.Branch) str += "\n" diff --git a/modules/github/display.go b/modules/github/display.go index ffbf2346..9d6b5821 100644 --- a/modules/github/display.go +++ b/modules/github/display.go @@ -35,7 +35,7 @@ func (widget *Widget) content() (string, string, bool) { } _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.GithubRepos), widget.Idx, width) + str := widget.settings.common.PaginationMarker(len(widget.GithubRepos), widget.Idx, width) if widget.settings.showStats { str += fmt.Sprintf("\n [%s]Stats[white]\n", widget.settings.common.Colors.Subheading) str += widget.displayStats(repo) diff --git a/modules/gitlab/display.go b/modules/gitlab/display.go index 66bf9962..ec413006 100644 --- a/modules/gitlab/display.go +++ b/modules/gitlab/display.go @@ -39,7 +39,7 @@ func (widget *Widget) content() (string, string, bool) { title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(project)) _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.GitlabProjects), widget.Idx, width) + "\n" + str := widget.settings.common.PaginationMarker(len(widget.GitlabProjects), widget.Idx, width) + "\n" str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading) str += widget.displayStats(project) str += "\n" diff --git a/modules/mercurial/display.go b/modules/mercurial/display.go index 82235251..15984c87 100644 --- a/modules/mercurial/display.go +++ b/modules/mercurial/display.go @@ -23,7 +23,7 @@ func (widget *Widget) content() (string, string, bool) { ) _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.Data), widget.Idx, width) + "\n" + str := widget.settings.common.PaginationMarker(len(widget.Data), widget.Idx, width) + "\n" str += fmt.Sprintf(" [%s]Branch:Bookmark[white]\n", widget.settings.common.Colors.Subheading) str += fmt.Sprintf(" %s:%s\n", repoData.Branch, repoData.Bookmark) str += "\n" diff --git a/modules/textfile/widget.go b/modules/textfile/widget.go index 048d2ded..959b63a9 100644 --- a/modules/textfile/widget.go +++ b/modules/textfile/widget.go @@ -78,7 +78,7 @@ func (widget *Widget) content() (string, string, bool) { ) _, _, width, _ := widget.View.GetRect() - text := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width) + "\n" + text := widget.settings.common.PaginationMarker(len(widget.Sources), widget.Idx, width) + "\n" if widget.settings.format { text += widget.formattedText() diff --git a/modules/twitter/widget.go b/modules/twitter/widget.go index 2e6bed68..66864deb 100644 --- a/modules/twitter/widget.go +++ b/modules/twitter/widget.go @@ -72,7 +72,7 @@ func (widget *Widget) content() (string, string, bool) { } _, _, width, _ := widget.View.GetRect() - str := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width-2) + "\n" + str := widget.settings.common.PaginationMarker(len(widget.Sources), widget.Idx, width-2) + "\n" for _, tweet := range tweets { str += widget.format(tweet) } diff --git a/modules/weatherservices/weather/display.go b/modules/weatherservices/weather/display.go index ccbafacf..1e4c0679 100644 --- a/modules/weatherservices/weather/display.go +++ b/modules/weatherservices/weather/display.go @@ -38,7 +38,7 @@ func (widget *Widget) content() (string, string, bool) { } else { title = widget.buildTitle(cityData) _, _, width, _ := widget.View.GetRect() - content = widget.settings.common.SigilStr(len(widget.Data), widget.Idx, width) + "\n" + content = widget.settings.common.PaginationMarker(len(widget.Data), widget.Idx, width) + "\n" content += widget.description(cityData) + "\n\n" content += widget.temperatures(cityData) + "\n" content += widget.sunInfo(cityData)