aboutsummaryrefslogtreecommitdiffstats
path: root/ccp.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-04-18 15:48:08 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-04-18 15:48:08 -0700
commitcdf2d155b484ef96527180435467e0b70b0ae8cf (patch)
tree8be02de838d1dc23d2ae7df82b476bccf3b61eb5 /ccp.go
parentHandle lines longer than terminal width (diff)
downloadccp-cdf2d155b484ef96527180435467e0b70b0ae8cf.tar.zst
Let errors scroll off the screen
Diffstat (limited to 'ccp.go')
-rw-r--r--ccp.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/ccp.go b/ccp.go
index 94eac96..e42195a 100644
--- a/ccp.go
+++ b/ccp.go
@@ -167,7 +167,7 @@ func run() error {
case <-frameTimer.C:
}
- width, _, err := term.GetSize(int(os.Stdout.Fd()))
+ width, height, err := term.GetSize(int(os.Stdout.Fd()))
if err != nil {
width = 80
}
@@ -175,7 +175,7 @@ func run() error {
currentProgress.mu.Lock()
current := currentProgress.current
- max := currentProgress.max
+ maxBytes := currentProgress.max
copyingFrom := currentProgress.copyingFrom
copyingTo := currentProgress.copyingTo
errs := currentProgress.errs
@@ -193,8 +193,8 @@ func run() error {
}
}
progress := 0.
- if max > 0 {
- progress = float64(current) / float64(max)
+ if maxBytes > 0 {
+ progress = float64(current) / float64(maxBytes)
}
etaStr := "..."
if eta >= 0 {
@@ -209,7 +209,7 @@ func run() error {
copyingFile,
bar.ViewAs(progress),
etaStr)
- for _, e := range errs {
+ for _, e := range errs[max(len(errs)-max(height-5, 0), 0):] {
fmt.Fprintln(renderer, warningStyle(e.Error()))
}
renderer.Flush()