-
|
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) |
Beta Was this translation helpful? Give feedback.
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. |
Beta Was this translation helpful? Give feedback.
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.