修复因筛选后未换行导致打印错位

This commit is contained in:
JIe 2024-11-20 14:02:17 +08:00
parent 8da6c9cfd2
commit e3c60f7c43

View File

@ -102,13 +102,14 @@ fn try_main() -> anyhow::Result<()> {
.filter_map(|line| {
let line = line.unwrap();
if line.contains(&filter_str) {
Some(line)
Some(line+"\n")
} else {
None
}
})
.flat_map(|str| str.into_bytes())
.collect();
println!("{}", String::from_utf8_lossy(&filter_data));
Box::new(Cursor::new(filter_data)) as Box<dyn Read>
}
}