Skip to content

Commit

Permalink
fix(player): Fix help column alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Nov 13, 2024
1 parent 4559631 commit 05cef89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
6 changes: 3 additions & 3 deletions internal/player/keymap.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func newKeymap() keymap {
),
chooseFull: key.NewBinding(
key.WithKeys(" ", "enter"),
key.WithHelp("enter/space", "select"),
key.WithHelp("enter", "select"),
),
jumps: jumps,
jump: key.NewBinding(
Expand All @@ -62,11 +62,11 @@ func newKeymap() keymap {
),
stepPrev: key.NewBinding(
key.WithKeys(","),
key.WithHelp(", (when paused)", "step backward"),
key.WithHelp(", (paused)", "step backward"),
),
stepNext: key.NewBinding(
key.WithKeys("."),
key.WithHelp(". (when paused)", "step forward"),
key.WithHelp(". (paused)", "step forward"),
),
help: key.NewBinding(
key.WithKeys("?"),
Expand Down
13 changes: 1 addition & 12 deletions internal/player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,7 @@ func (p *Player) OptionsView() string {
}

func (p *Player) HelpView() string {
v := p.help.View(p.keymap)
if p.help.ShowAll {
sep := p.help.Styles.FullSeparator.Render(p.help.FullSeparator)
sepSpaces := strings.Repeat(" ", lipgloss.Width(sep))
// Remove first line separator
v = strings.Replace(v, sep+"\n", "\n", 1)
// Remove separator spaces form other lines
v = strings.ReplaceAll(v, sepSpaces+"\n", "\n")
// Remove separator spaces from final line
v = strings.TrimSuffix(v, sepSpaces)
}
return p.zone.Mark("help", v)
return p.zone.Mark("help", p.help.View(p.keymap))
}

func (p *Player) pause() {
Expand Down

0 comments on commit 05cef89

Please sign in to comment.