mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 03:25:23 +00:00
Display stdin more intuitively top-down instead of bottom-up (#50)
* fix: Don't include empty lines and whitespace when precessing stdin * fix: Display stdin more intuitively top-down instead of bottom-up
This commit is contained in:
parent
30639c66b0
commit
44de19a01e
@ -19,11 +19,13 @@ impl Channel {
|
||||
pub fn new() -> Self {
|
||||
let mut lines = Vec::new();
|
||||
for line in std::io::stdin().lock().lines().map_while(Result::ok) {
|
||||
lines.push(preprocess_line(&line));
|
||||
if !line.trim().is_empty() {
|
||||
lines.push(preprocess_line(&line));
|
||||
}
|
||||
}
|
||||
let matcher = Matcher::new(Config::default().n_threads(NUM_THREADS));
|
||||
let injector = matcher.injector();
|
||||
for line in &lines {
|
||||
for line in lines.iter().rev() {
|
||||
let () = injector.push(line.clone(), |e, cols| {
|
||||
cols[0] = e.clone().into();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user