summaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorCorey Ford <corey@coreyford.name>2015-02-21 19:22:53 -0800
committerCorey Ford <corey@coreyford.name>2015-02-21 19:31:17 -0800
commit43e806199675ce7cb4fdf78b73a554e1d80c0149 (patch)
treec257b344fee9fa4f4ed904414514945b6ccec201 /src/output
parenta4e17193d990340b163efceff8eb5e513199d704 (diff)
Use file_name_width in grid
Filenames with characters that need multiple bytes in UTF-8, and/or control characters like combining diacritics, would break the grid. `StrExt::width` seems to do the right thing, and there's conveniently a function here (which was otherwise unused) to call that.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/grid.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/output/grid.rs b/src/output/grid.rs
index 8c5d632..d04e0b2 100644
--- a/src/output/grid.rs
+++ b/src/output/grid.rs
@@ -51,7 +51,7 @@ impl Grid {
else {
index / num_lines
};
- column_widths[index] = max(column_widths[index], file.name.len());
+ column_widths[index] = max(column_widths[index], file.file_name_width());
}
// If they all fit in the terminal, combined, then success!
@@ -87,8 +87,8 @@ impl Grid {
print!("{}", styled_name);
}
else {
- assert!(widths[x] >= file.name.len());
- print!("{}", Left.pad_string(&styled_name, widths[x] - file.name.len() + 2));
+ assert!(widths[x] >= file.file_name_width());
+ print!("{}", Left.pad_string(&styled_name, widths[x] - file.file_name_width() + 2));
}
}
print!("\n");