mirror of
https://github.com/ollama/ollama.git
synced 2025-04-07 03:18:24 +02:00
only move cursor up if pos > 0
This commit is contained in:
parent
d6ecaa2cbf
commit
7ea905871a
@ -25,7 +25,7 @@ type Progress struct {
|
||||
}
|
||||
|
||||
func NewProgress(w io.Writer) *Progress {
|
||||
p := &Progress{pos: -1, w: w}
|
||||
p := &Progress{w: w}
|
||||
go p.start()
|
||||
return p
|
||||
}
|
||||
@ -71,7 +71,10 @@ func (p *Progress) render() error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
fmt.Fprintf(p.w, "\033[%dA", p.pos)
|
||||
if p.pos > 0 {
|
||||
fmt.Fprintf(p.w, "\033[%dA", p.pos)
|
||||
}
|
||||
|
||||
for _, state := range p.states {
|
||||
fmt.Fprintln(p.w, state.String())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user