mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-13 07:56:29 +00:00
Fix tree output
This commit is contained in:
parent
77fa8974c4
commit
d083d26eaf
@ -116,6 +116,7 @@ use std::io;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
|
use std::iter::repeat;
|
||||||
|
|
||||||
use colours::Colours;
|
use colours::Colours;
|
||||||
use column::{Alignment, Column, Cell};
|
use column::{Alignment, Column, Cell};
|
||||||
@ -683,7 +684,14 @@ impl<U> Table<U> where U: Users {
|
|||||||
// necessary to maintain information about the previously-printed
|
// necessary to maintain information about the previously-printed
|
||||||
// lines, as the output will change based on whether the
|
// lines, as the output will change based on whether the
|
||||||
// *previous* entry was the last in its directory.
|
// *previous* entry was the last in its directory.
|
||||||
stack.reserve(row.depth + 1);
|
// TODO: Replace this by Vec::resize() when it becomes stable (1.5.0)
|
||||||
|
let stack_len = stack.len();
|
||||||
|
if row.depth + 1 > stack_len {
|
||||||
|
stack.extend(repeat(TreePart::Edge).take(row.depth + 1 - stack_len));
|
||||||
|
} else {
|
||||||
|
stack = stack[..(row.depth + 1)].into();
|
||||||
|
}
|
||||||
|
|
||||||
stack[row.depth] = if row.last { TreePart::Corner } else { TreePart::Edge };
|
stack[row.depth] = if row.last { TreePart::Corner } else { TreePart::Edge };
|
||||||
|
|
||||||
for i in 1 .. row.depth + 1 {
|
for i in 1 .. row.depth + 1 {
|
||||||
|
Loading…
Reference in New Issue
Block a user