Improved reading when no flags are specified.

This commit is contained in:
Erik C. Thauvin 2021-10-16 14:58:30 -07:00
parent edb77726f1
commit 96b4784fc8

View file

@ -125,14 +125,16 @@ Future<void> _writeStream(
!numberNonBlank && !numberNonBlank &&
!showTabs && !showTabs &&
!squeezeBlank && !squeezeBlank &&
!showNonPrinting; !showNonPrinting) {
final sb = StringBuffer(); await stream.transform(utf8.decoder).forEach(out.write);
await stream.forEach((data) { } else {
sb.clear(); const tab = 9;
for (final ch in utf8.decode(data).runes) { int squeeze = 0;
if (noFlags) { final sb = StringBuffer();
sb.writeCharCode(ch);
} else { await stream.forEach((data) {
sb.clear();
for (final ch in utf8.decode(data).runes) {
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); }
} });
}); }
} }