Skip to content

Commit

Permalink
fix: fullscreen
Browse files Browse the repository at this point in the history
closes #110
  • Loading branch information
caarlos0 committed Jul 15, 2024
1 parent bb17228 commit cd7d768
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

func (m model) View() string {
if m.quitting || m.interrupting {
return "\n"
return ""
}

var startTimeFormat string
Expand All @@ -102,8 +102,9 @@ func (m model) View() string {
}
result += " - " + boldStyle.Render(m.timer.View()) + "\n" + m.progress.View()
if m.altscreen {
textWidth, textHeight := lipgloss.Size(result)
return lipgloss.NewStyle().Margin((winHeight-textHeight)/2, (winWidth-textWidth)/2).Render(result)
return altscreenStyle.
MarginTop((winHeight - 2) / 2).
Render(result)
}
return result
}
Expand All @@ -116,6 +117,7 @@ var (
version = "dev"
quitKeys = key.NewBinding(key.WithKeys("esc", "q"))
intKeys = key.NewBinding(key.WithKeys("ctrl+c"))
altscreenStyle = lipgloss.NewStyle().MarginLeft(padding)
boldStyle = lipgloss.NewStyle().Bold(true)
italicStyle = lipgloss.NewStyle().Italic(true)
)
Expand Down

0 comments on commit cd7d768

Please sign in to comment.