summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhcpl <hcpl.prog@gmail.com>2017-06-03 23:04:12 +0300
committerhcpl <hcpl.prog@gmail.com>2017-06-03 23:04:12 +0300
commit367118a83c06cac72f6c9ce3d87b0fb6f00075ec (patch)
tree5d5956137d80000ac64bb9a572394c773fe79a7e /src
parent831898577e87b587d24769bad38fcdcd2e5522d9 (diff)
Fix padding formatting
Line separators relied on (1, 1) padding.
Diffstat (limited to 'src')
-rw-r--r--src/format.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/format.rs b/src/format.rs
index 0293b67..a9b77cb 100644
--- a/src/format.rs
+++ b/src/format.rs
@@ -60,6 +60,7 @@ impl LineSeparator {
pub fn print<T: Write + ?Sized>(&self,
out: &mut T,
col_width: &[usize],
+ padding: (usize, usize),
colsep: bool,
lborder: bool,
rborder: bool)
@@ -69,7 +70,7 @@ impl LineSeparator {
}
let mut iter = col_width.into_iter().peekable();
while let Some(width) = iter.next() {
- for _ in 0..width + 2 {
+ for _ in 0..width + padding.0 + padding.1 {
try!(out.write_all(Utf8Char::from(self.line).as_bytes()));
}
if colsep && iter.peek().is_some() {
@@ -191,6 +192,7 @@ impl TableFormat {
Some(ref l) => {
l.print(out,
col_width,
+ self.get_padding(),
self.csep.is_some(),
self.lborder.is_some(),
self.rborder.is_some())