Clear status message on enableProgressBar(false)

Motivated by `meteor shell` in Emacs shell-mode
This commit is contained in:
David Greenspan
2014-09-30 09:33:13 -07:00
parent 1f3538e982
commit 44ae2cbea9

View File

@@ -261,13 +261,7 @@ _.extend(Console.prototype, {
}
}
// For the non-progress-bar status mode, we may need to
// clear some characters that we printed with a trailing `\r`.
if (self._wroteStatusMessage) {
var spaces = new Array(TEMP_STATUS_LENGTH + 1).join(' ');
self._stream.write(spaces + '\r');
self._wroteStatusMessage = false;
}
self._clearStatusMessage();
if (style) {
dest.write(style(message + '\n'));
@@ -281,6 +275,17 @@ _.extend(Console.prototype, {
}
},
_clearStatusMessage: function () {
var self = this;
// For the non-progress-bar status mode, we may need to
// clear some characters that we printed with a trailing `\r`.
if (self._wroteStatusMessage) {
var spaces = new Array(TEMP_STATUS_LENGTH + 1).join(' ');
self._stream.write(spaces + '\r');
self._wroteStatusMessage = false;
}
},
_format: function (logArguments) {
var self = this;
@@ -318,7 +323,12 @@ _.extend(Console.prototype, {
// It's important that we only enter status message mode
// if self._pretty, so that we don't start displaying
// status messages too soon.
self._inStatusMessageMode = true;
if (enabled) {
self._inStatusMessageMode = true;
} else if (self._inStatusMessageMode) {
self._clearStatusMessage();
self._inStatusMessageMode = false;
}
return;
}