Skip to content

Commit 0636e7c

Browse files
authored
Merge pull request webpack#3594 from d-ph/fix/issue-3591-progress-indication-is-not-being-shown-correctly
Fix progress indicator erasing too many characters. Fixes webpack#3591
2 parents e8cb875 + 2417991 commit 0636e7c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎lib/ProgressPlugin.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ ProgressPlugin.prototype.apply = function(compiler) {
131131
});
132132
}
133133

134-
var chars = 0,
134+
var lineCaretPosition = 0,
135135
lastState, lastStateTime;
136136

137137
function defaultHandler(percentage, msg) {
@@ -165,7 +165,7 @@ ProgressPlugin.prototype.apply = function(compiler) {
165165
var stateMsg = (now - lastStateTime) + "ms " + lastState;
166166
goToLineStart(stateMsg);
167167
process.stderr.write(stateMsg + "\n");
168-
chars = 0;
168+
lineCaretPosition = 0;
169169
}
170170
lastState = state;
171171
lastStateTime = now;
@@ -177,13 +177,13 @@ ProgressPlugin.prototype.apply = function(compiler) {
177177

178178
function goToLineStart(nextMessage) {
179179
var str = "";
180-
for(; chars > nextMessage.length; chars--) {
180+
for(; lineCaretPosition > nextMessage.length; lineCaretPosition--) {
181181
str += "\b \b";
182182
}
183-
chars = nextMessage.length;
184-
for(var i = 0; i < chars; i++) {
183+
for(var i = 0; i < lineCaretPosition; i++) {
185184
str += "\b";
186185
}
186+
lineCaretPosition = nextMessage.length;
187187
if(str) process.stderr.write(str);
188188
}
189189
};

0 commit comments

Comments
 (0)