Explorar o código

Fix bug where details view needed a terminal width

The buggy code assumed that, if output isn't to a terminal, then the only view available is the Lines view. This is incorrect, as the Details view doesn't require a set width either, so check for --long even when there's no set width.
Ben S %!s(int64=10) %!d(string=hai) anos
pai
achega
1756a0a841
Modificáronse 1 ficheiros con 18 adicións e 4 borrados
  1. 18 4
      src/options.rs

+ 18 - 4
src/options.rs

@@ -265,11 +265,25 @@ impl View {
                     TerminalColours::Automatic => Colours::plain(),
                 };
 
-                let lines = Lines {
-                     colours: colours,
-                };
+                if matches.opt_present("tree") {
+                    let details = Details {
+                        columns: None,
+                        header: false,
+                        recurse: dir_action.recurse_options(),
+                        filter: filter,
+                        xattr: false,
+                        colours: colours,
+                    };
 
-                Ok(View::Lines(lines))
+                    Ok(View::Details(details))
+                }
+                else {
+                    let lines = Lines {
+                         colours: colours,
+                    };
+
+                    Ok(View::Lines(lines))
+                }
             }
         };