@@ -150,10 +150,10 @@ func Run(ctx context.Context, opts Options) error {
150150 if tty {
151151 extra := ""
152152 if lastPeers > 0 {
153- extra += fmt .Sprintf (" | peers: %d" , lastPeers )
153+ extra += fmt .Sprintf (" peers: %d" , lastPeers )
154154 }
155155 if lastLatency > 0 {
156- extra += fmt .Sprintf (" | rtt: %dms" , lastLatency )
156+ extra += fmt .Sprintf (" rtt: %dms" , lastLatency )
157157 }
158158 fmt .Fprintf (opts .Out , "\r \033 [K %s%s" , lineWithETA , extra )
159159 } else {
@@ -236,10 +236,10 @@ func Run(ctx context.Context, opts Options) error {
236236 if tty {
237237 extra := ""
238238 if lastPeers > 0 {
239- extra += fmt .Sprintf (" | peers: %d" , lastPeers )
239+ extra += fmt .Sprintf (" peers: %d" , lastPeers )
240240 }
241241 if lastLatency > 0 {
242- extra += fmt .Sprintf (" | rtt: %dms" , lastLatency )
242+ extra += fmt .Sprintf (" rtt: %dms" , lastLatency )
243243 }
244244 fmt .Fprintf (opts .Out , "\r \033 [K %s%s" , lineWithETA , extra )
245245 } else {
@@ -307,10 +307,10 @@ func Run(ctx context.Context, opts Options) error {
307307 if tty {
308308 extra := ""
309309 if lastPeers > 0 {
310- extra += fmt .Sprintf (" | peers: %d" , lastPeers )
310+ extra += fmt .Sprintf (" peers: %d" , lastPeers )
311311 }
312312 if lastLatency > 0 {
313- extra += fmt .Sprintf (" | rtt: %dms" , lastLatency )
313+ extra += fmt .Sprintf (" rtt: %dms" , lastLatency )
314314 }
315315 fmt .Fprintf (opts .Out , "\r \033 [K %s%s" , lineWithETA , extra )
316316 } else {
@@ -368,10 +368,10 @@ func Run(ctx context.Context, opts Options) error {
368368 if tty {
369369 extra := ""
370370 if lastPeers > 0 {
371- extra += fmt .Sprintf (" | peers: %d" , lastPeers )
371+ extra += fmt .Sprintf (" peers: %d" , lastPeers )
372372 }
373373 if lastLatency > 0 {
374- extra += fmt .Sprintf (" | rtt: %dms" , lastLatency )
374+ extra += fmt .Sprintf (" rtt: %dms" , lastLatency )
375375 }
376376 fmt .Fprintf (opts .Out , "\r \033 [K %s%s" , lineWithETA , extra )
377377 } else {
@@ -413,10 +413,10 @@ func Run(ctx context.Context, opts Options) error {
413413 if tty {
414414 extra := ""
415415 if lastPeers > 0 {
416- extra += fmt .Sprintf (" | peers: %d" , lastPeers )
416+ extra += fmt .Sprintf (" peers: %d" , lastPeers )
417417 }
418418 if lastLatency > 0 {
419- extra += fmt .Sprintf (" | rtt: %dms" , lastLatency )
419+ extra += fmt .Sprintf (" rtt: %dms" , lastLatency )
420420 }
421421 fmt .Fprintf (opts .Out , "\r \033 [K %s%s" , lineWithETA , extra )
422422 } else {
@@ -455,10 +455,10 @@ func Run(ctx context.Context, opts Options) error {
455455 if tty {
456456 extra := ""
457457 if lastPeers > 0 {
458- extra += fmt .Sprintf (" | peers: %d" , lastPeers )
458+ extra += fmt .Sprintf (" peers: %d" , lastPeers )
459459 }
460460 if lastLatency > 0 {
461- extra += fmt .Sprintf (" | rtt: %dms" , lastLatency )
461+ extra += fmt .Sprintf (" rtt: %dms" , lastLatency )
462462 }
463463 fmt .Fprintf (opts .Out , "\r \033 [K %s%s\n " , lineWithETA , extra )
464464 } else {
@@ -685,9 +685,9 @@ func progressRateAndETA(buf []pt, cur, remote int64) (float64, string) {
685685 if rem < 0 {
686686 rem = 0
687687 }
688- eta = fmt .Sprintf (" | ETA: %s" , (time .Duration (rem * float64 (time .Second ))).Round (time .Second ))
688+ eta = fmt .Sprintf (" ETA %s" , (time .Duration (rem * float64 (time .Second ))).Round (time .Second ))
689689 } else if remote > 0 {
690- eta = " | ETA: 0s"
690+ eta = " ETA 0s"
691691 }
692692 return rate , eta
693693}
@@ -705,7 +705,7 @@ func renderProgress(percent float64, cur, remote int64) string {
705705 filled = width
706706 }
707707 bar := strings .Repeat ("█" , filled ) + strings .Repeat ("░" , width - filled )
708- return fmt .Sprintf ("→ Syncing [%s] %.2f%% | %d/%d blocks" , bar , percent , cur , remote )
708+ return fmt .Sprintf ("→ Syncing [%s] %.2f%% %d/%d blocks" , bar , percent , cur , remote )
709709}
710710
711711func renderProgressWithQuiet (percent float64 , cur , remote int64 , quiet bool ) string {
@@ -725,7 +725,7 @@ func renderProgressWithQuiet(percent float64, cur, remote int64, quiet bool) str
725725 filled = width
726726 }
727727 bar := strings .Repeat ("#" , filled ) + strings .Repeat ("-" , width - filled )
728- return fmt .Sprintf ("[%s] %.2f%% | %d/%d" , bar , percent , cur , remote )
728+ return fmt .Sprintf ("[%s] %.2f%% %d/%d" , bar , percent , cur , remote )
729729 }
730730 return renderProgress (percent , cur , remote )
731731}
@@ -740,11 +740,15 @@ func isTTY() bool {
740740
741741func hideCursor (w io.Writer , tty bool ) {
742742 if tty {
743+ // Disable focus reporting (prevents ^[[I/^[[O sequences)
744+ fmt .Fprint (w , "\x1b [?1004l" )
745+ // Hide cursor
743746 fmt .Fprint (w , "\x1b [?25l" )
744747 }
745748}
746749func showCursor (w io.Writer , tty bool ) {
747750 if tty {
751+ // Show cursor (don't re-enable focus reporting as it wasn't necessarily on before)
748752 fmt .Fprint (w , "\x1b [?25h" )
749753 }
750754}
0 commit comments