diff --git a/example/singleBar/e.txt b/example/singleBar/e.txt deleted file mode 100644 index e69de29..0000000 diff --git a/progress.go b/progress.go index fa58098..beda20c 100644 --- a/progress.go +++ b/progress.go @@ -5,6 +5,7 @@ "errors" "io" "os" + "sort" "sync" "time" @@ -206,6 +207,13 @@ case respCh := <-p.barCountReqCh: respCh <- len(bars) case <-t.C: + switch p.sort { + case SortTop: + sort.Sort(sort.Reverse(SortableBarSlice(bars))) + case SortBottom: + sort.Sort(SortableBarSlice(bars)) + } + width, _ := cwriter.TerminalWidth() ibars := iBarsGen(p.ctx.Done(), bars, width) c := make(chan *indexedBarBuffer)