|
Hello, The problem is that when you run the program again, the last part of the previous output is erased (like when you call the The View() function: func (m model) View() tea.View {
if !m.ready {
return tea.NewView("Initializing...")
}
status := checkMark.Render("Completed!")
if m.completed < m.totalNodes {
status = m.spinner.View() + " " + grayStyle.Render(" Running...")
}
if m.quitting {
status = grayStyle.Render("Interrupted, shutting down...")
}
var problems strings.Builder
if m.quitting || m.done {
for problem := range m.problems {
problems.WriteString(warnMark.Render(grayStyle.Render(problem)) + "\n")
}
}
delimiter := grayStyle.Render(strings.Repeat("─", m.width))
progressBar := m.progress.ViewAs(float64(m.completed) / float64(m.totalNodes))
progress := fmt.Sprintf("[%3d/%3d] %s\n", m.completed, m.totalNodes, progressBar)
info := grayStyle.Render("Press Esc, Q or Ctrl+C to exit")
return tea.NewView(lipgloss.JoinVertical(lipgloss.Left, status, delimiter, problems.String(), progress, info))
}The results are printed with tea.Println, View is used only for a bottom part (progress bar, status, summary) |
Answered by
furysta
Apr 24, 2026
Replies: 1 comment
|
The problem is solved. Don't know exactly why, but the cause of the problem was There is an example in package-manager. |
0 replies
Answer selected by
furysta
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is solved. Don't know exactly why, but the cause of the problem was
m.progress.ViewAs(...)inView()function. I've replaced it with am.progress.View()and added proper progress logic intoUpdate()function.There is an example in package-manager.