There was an error while loading. Please reload this page.
2 parents 1602f21 + d498b99 commit dac1a9dCopy full SHA for dac1a9d
Sources/Utility/ProgressAnimation.swift
@@ -105,8 +105,16 @@ public final class RedrawingNinjaProgressAnimation: ProgressAnimationProtocol {
105
assert(step <= total)
106
107
terminal.clearLine()
108
- terminal.write("[\(step)/\(total)] ")
109
- terminal.write(text)
+
+ let progressText = "[\(step)/\(total)] \(text)"
110
+ if progressText.utf8.count > terminal.width {
111
+ let suffix = "…"
112
+ terminal.write(String(progressText.prefix(terminal.width - suffix.utf8.count)))
113
+ terminal.write(suffix)
114
+ } else {
115
+ terminal.write(progressText)
116
+ }
117
118
hasDisplayedProgress = true
119
}
120
0 commit comments