Forráskód Böngészése

Use one-line view when output is not to a terminal

Ben S 11 éve
szülő
commit
35a0ba3ba0
1 módosított fájl, 4 hozzáadás és 2 törlés
  1. 4 2
      src/options.rs

+ 4 - 2
src/options.rs

@@ -74,8 +74,10 @@ impl Options {
             Lines
         }
         else {
-            let (console_width, _) = term::dimensions().unwrap_or((80, 24));
-            Grid(matches.opt_present("across"), console_width)
+            match term::dimensions() {
+                None => Lines,
+                Some((width, _)) => Grid(matches.opt_present("across"), width),
+            }
         }
     }