From 8b9e4daf366fb1fc60c47e31a69d650901bd670e Mon Sep 17 00:00:00 2001 From: Xavier Godart Date: Fri, 9 Aug 2024 10:59:42 +0200 Subject: [PATCH] fix offset parameter display --- sequencer/step.go | 3 --- ui/step.go | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sequencer/step.go b/sequencer/step.go index 628d52d..4f90dad 100644 --- a/sequencer/step.go +++ b/sequencer/step.go @@ -159,9 +159,6 @@ func (s step) ProbabilityString() string { // OffsetString returns the string representation of the step offset. func (s step) OffsetString() string { - if s.offset == 0 { - return "" - } return fmt.Sprintf("+%d", s.offset) } diff --git a/ui/step.go b/ui/step.go index 45ab5a5..89aa581 100644 --- a/ui/step.go +++ b/ui/step.go @@ -108,6 +108,10 @@ func (m mainModel) renderStepContent(step sequencer.Step) string { if !step.IsActive() { return strconv.Itoa(step.Position() + 1) } + offset := step.OffsetString() + if step.Offset() == 0 { + offset = "" + } return lipgloss.JoinVertical( lipgloss.Left, fmt.Sprintf("%d", step.Position()+1), @@ -120,7 +124,7 @@ func (m mainModel) renderStepContent(step sequencer.Step) string { Render(step.ProbabilityString()), lipgloss.NewStyle(). MarginLeft(1). - Render(step.OffsetString()), + Render(offset), ), ) }