Closed gosuri closed 5 years ago
This commit on my fork works for windows too. It has a dependency on github.com/nsf/termbox-go
.
Example code which works with this forked package:
package main
import (
"fmt"
"time"
"github.com/apoorva/uilive"
)
func main() {
writer := uilive.New()
// start listening for updates and render
writer.Start()
uilive.InitializeTerminalWidth()
str := ""
for i:=0; i<200; i++ {
str += "s"
}
str += "[end]"
for i := 0; i <= 100; i++ {
fmt.Fprintf(writer, "%d %s\n", i, str)
time.Sleep(time.Second)
}
fmt.Fprintln(writer, "Finished: Downloaded 100GB")
writer.Stop() // flush and stop rendering
}
This might be late for you but I think this could be helpful for you or someone else who might stumble over this issue:
I have made a fork of this library and have managed to fix most of the issues. I would gladly do a PR here if @gosuri is interested in reviving this package. Until then, we could collaborate and keep this wonderful package alive right here: https://github.com/asahasrabuddhe/uilive
The last line seems to be overwritten when width of the buffer exceeds screen width:
Code:
(Ref #2)