Improved reading when no flags are specified.
This commit is contained in:
parent
edb77726f1
commit
96b4784fc8
1 changed files with 15 additions and 13 deletions
|
@ -125,14 +125,16 @@ Future<void> _writeStream(
|
||||||
!numberNonBlank &&
|
!numberNonBlank &&
|
||||||
!showTabs &&
|
!showTabs &&
|
||||||
!squeezeBlank &&
|
!squeezeBlank &&
|
||||||
!showNonPrinting;
|
!showNonPrinting) {
|
||||||
|
await stream.transform(utf8.decoder).forEach(out.write);
|
||||||
|
} else {
|
||||||
|
const tab = 9;
|
||||||
|
int squeeze = 0;
|
||||||
final sb = StringBuffer();
|
final sb = StringBuffer();
|
||||||
|
|
||||||
await stream.forEach((data) {
|
await stream.forEach((data) {
|
||||||
sb.clear();
|
sb.clear();
|
||||||
for (final ch in utf8.decode(data).runes) {
|
for (final ch in utf8.decode(data).runes) {
|
||||||
if (noFlags) {
|
|
||||||
sb.writeCharCode(ch);
|
|
||||||
} else {
|
|
||||||
if (lastLine.lastChar == _lineFeed) {
|
if (lastLine.lastChar == _lineFeed) {
|
||||||
if (squeezeBlank) {
|
if (squeezeBlank) {
|
||||||
if (ch == _lineFeed) {
|
if (ch == _lineFeed) {
|
||||||
|
@ -189,9 +191,9 @@ Future<void> _writeStream(
|
||||||
}
|
}
|
||||||
sb.writeCharCode(ch);
|
sb.writeCharCode(ch);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (sb.isNotEmpty) {
|
if (sb.isNotEmpty) {
|
||||||
out.write(sb);
|
out.write(sb);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue