summaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-05-16 14:30:01 +0100
committerBen S <ogham@bsago.me>2015-05-16 14:30:01 +0100
commit1bb7a4e47e5428d9204c36d887add4a21923f75c (patch)
tree614befce9e4e319fea704d210ad4628b4ae983f7 /src/output
parent2594690aff1f23e0dbb42576daed2788960bcbd7 (diff)
Remove space when no file has extended attributes
There would be an extra column, and it looked unsightly. Unsightly! This also removes the last specific style from the details view (Plain).
Diffstat (limited to 'src/output')
-rw-r--r--src/output/details.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/output/details.rs b/src/output/details.rs
index 28c8228..8455a07 100644
--- a/src/output/details.rs
+++ b/src/output/details.rs
@@ -10,7 +10,6 @@ use users::{OSUsers, Users};
use super::filename;
use ansi_term::{ANSIString, ANSIStrings, Style};
-use ansi_term::Style::Plain;
use locale;
@@ -213,9 +212,9 @@ impl Table {
};
let x_colour = if let f::Type::File = permissions.file_type { c.user_execute_file }
- else { c.user_execute_other };
+ else { c.user_execute_other };
- let string = ANSIStrings( &[
+ let mut columns = vec![
file_type,
bit(permissions.user_read, "r", c.user_read),
bit(permissions.user_write, "w", c.user_write),
@@ -226,12 +225,15 @@ impl Table {
bit(permissions.other_read, "r", c.other_read),
bit(permissions.other_write, "w", c.other_write),
bit(permissions.other_execute, "x", c.other_execute),
- if permissions.attribute { c.attribute.paint("@") } else { Plain.paint(" ") },
- ]).to_string();
+ ];
+
+ if permissions.attribute {
+ columns.push(c.attribute.paint("@"));
+ }
Cell {
- text: string,
- length: 11,
+ text: ANSIStrings(&columns).to_string(),
+ length: columns.len(),
}
}