recordCommand method
void
recordCommand(
- String explanation, {
- bool error = false,
})
Implementation
void recordCommand(String explanation, {bool error = false}) {
final start = _parser.tokenBegin;
final end = _parser.tokenEnd;
if (commands.isNotEmpty && commands.last.end == end) {
final last = commands.last;
last.explanation.add(explanation);
if (error && !last.error) {
commands[commands.length - 1] = TerminalCommand(
last.start,
last.end,
last.chars,
last.escapedChars,
last.explanation,
true,
);
}
} else {
final charCodes = recorded.sublist(start, end);
final chars = String.fromCharCodes(charCodes);
final escapedChars = _escape(chars);
commands.add(
TerminalCommand(start, end, chars, escapedChars, [explanation], error),
);
}
}