Unverified Commit ec93c87c authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

Move spinner `_defaultSlowWarning` message to a new line (#30071)

* write newline before adding slow restart message to spinner
* update existing test
parent b70d260b
......@@ -620,6 +620,8 @@ class AnsiSpinner extends Status {
final String _backspaceChar = '\b';
final String _clearChar = ' ';
bool timedOut = false;
int ticks = 0;
Timer timer;
......@@ -660,15 +662,19 @@ class AnsiSpinner extends Status {
assert(timer.isActive);
stdout.write(_backspace);
ticks += 1;
stdout.write('${_clearChar * spinnerIndent}$_currentAnimationFrame');
if (seemsSlow) {
if (!timedOut) {
timedOut = true;
stdout.write('$_clear\n');
}
if (slowWarningCallback != null) {
_slowWarning = ' ' + slowWarningCallback();
_slowWarning = slowWarningCallback();
} else {
_slowWarning = ' ' + _defaultSlowWarning;
_slowWarning = _defaultSlowWarning;
}
stdout.write(_slowWarning);
}
stdout.write('${_clearChar * spinnerIndent}$_currentAnimationFrame');
}
@override
......
......@@ -148,7 +148,8 @@ void main() {
await tenMillisecondsLater;
doWhileAsync(time, () => ansiSpinner.ticks < 30); // three seconds
expect(ansiSpinner.seemsSlow, isTrue);
expect(outputStdout().join('\n'), contains('This is taking an unexpectedly long time.'));
// Check the 2nd line to verify there's a newline before the warning
expect(outputStdout()[1], contains('This is taking an unexpectedly long time.'));
ansiSpinner.stop();
expect(outputStdout().join('\n'), isNot(contains('(!)')));
done = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment