diff options
-rw-r--r-- | internal/progress/progress.go | 12 | ||||
-rw-r--r-- | internal/switcher/switcher.go | 11 | ||||
-rw-r--r-- | internal/ui/style.go | 2 |
3 files changed, 19 insertions, 6 deletions
diff --git a/internal/progress/progress.go b/internal/progress/progress.go index 9a3b37e..c6caade 100644 --- a/internal/progress/progress.go +++ b/internal/progress/progress.go @@ -107,6 +107,18 @@ func WithFillCharacters(steps []FillStep) Option { } } +// WithBinaryFill results in a less granular but possible more widely compatible +// progress bar as only two characters are used to represent completion of a +// single block (full/complete and empty/incomplete). +func WithBinaryFill() Option { + return func(m *Model) { + m.FillSteps = []FillStep{ + {' ', 0.0}, + {'█', 1.0}, + } + } +} + // WithoutPercentage hides the numeric percentage. func WithoutPercentage() Option { return func(m *Model) { diff --git a/internal/switcher/switcher.go b/internal/switcher/switcher.go index 91a46ef..e0b9579 100644 --- a/internal/switcher/switcher.go +++ b/internal/switcher/switcher.go @@ -123,15 +123,16 @@ func (m Model) View() string { m.help.Styles.ShortKey.Width(w) - var helpstr string + var helpStr string + m.help.Width = w if m.fullHelp { - helpstr = m.help.FullHelpView(m.AllKeys()) + helpStr = m.help.FullHelpView(m.AllKeys()) } else { // This is a hack since the current view has too many keys // and the horizontal "ShortHelpView" gets too wide. // "FullHelpView" seperates keys by columns (and we only show the first). - // helpstr = m.help.FullHelpView([][]key.Binding{m.AllKeys()[0]}) - helpstr = m.help.FullHelpView(shortKeys()) + // helpStr = m.help.FullHelpView([][]key.Binding{m.AllKeys()[0]}) + helpStr = m.help.FullHelpView(shortKeys()) } var inputStr string @@ -143,7 +144,7 @@ func (m Model) View() string { mainArea := ui.Style().Boxed.Render(strings.Join([]string{ pickerStr, previewStr, - helpstr, + helpStr, }, "\n")) return strings.Join( diff --git a/internal/ui/style.go b/internal/ui/style.go index 71bff48..f6f7169 100644 --- a/internal/ui/style.go +++ b/internal/ui/style.go @@ -61,7 +61,7 @@ func init() { baseSliderOpts := []progress.Option{ progress.WithColorProfile(ColorProfile()), progress.WithoutPercentage(), - // progress.WithFillCharacters(" ", "█"), // for legacy look + // progress.WithBinaryFill(), // uncomment for legacy look } style = StyleSheet{ |