@@ -46,6 +46,7 @@ final class StepManager with TerminalTools {
46
46
/// Add new step to the task.
47
47
Future <T > step <T >(String message, {FutureOr <T > Function ()? callback}) {
48
48
if (isInitialStep) {
49
+ _terminal.enableRawMode ();
49
50
createSpace (_terminal, 1 );
50
51
_position = readCursorPosition (_terminal);
51
52
isInitialStep = false ;
@@ -63,7 +64,7 @@ final class StepManager with TerminalTools {
63
64
final buffer = StringBuffer ();
64
65
65
66
buffer.writeAnsiAll ([
66
- CursorPosition .moveTo (_position ! .$2, _position! .$1),
67
+ CursorPosition .moveToColumn ( _position! .$1),
67
68
SetStyles (Style .foreground (Color .green)),
68
69
Print (_loadingSteps[_loadingStep]),
69
70
SetStyles .reset
@@ -90,6 +91,7 @@ final class StepManager with TerminalTools {
90
91
91
92
_timer? .cancel ();
92
93
stdout.write (buffer.toString ());
94
+ _terminal.disableRawMode ();
93
95
}
94
96
95
97
/// Finishes the task with an error message.
@@ -106,6 +108,7 @@ final class StepManager with TerminalTools {
106
108
107
109
_timer? .cancel ();
108
110
stdout.write (buffer.toString ());
111
+ _terminal.disableRawMode ();
109
112
}
110
113
111
114
/// Finishes the task with an error message.
@@ -122,10 +125,17 @@ final class StepManager with TerminalTools {
122
125
123
126
_timer? .cancel ();
124
127
stdout.write (buffer.toString ());
128
+ _terminal.disableRawMode ();
125
129
}
126
130
127
131
List <Sequence > _messageSequence (String message) {
128
- return [Print (message), SetStyles .reset, AsciiControl .lineFeed];
132
+ return [
133
+ Print (message),
134
+ SetStyles .reset,
135
+ CursorVisibility .show,
136
+ AsciiControl .lineFeed,
137
+ const CursorPosition .moveToColumn (0 )
138
+ ];
129
139
}
130
140
131
141
void _drawLoader (void Function () render) {
@@ -163,7 +173,6 @@ final class StepTask<T> {
163
173
SetStyles (Style .foreground (Color .brightBlack)),
164
174
Print (' $_message ' ),
165
175
SetStyles .reset,
166
- AsciiControl .lineFeed,
167
176
]);
168
177
169
178
stdout.write (buffer.toString ());
0 commit comments