From 2ea3758c4b9cfdfce3612dc4fd425b785c8942e1 Mon Sep 17 00:00:00 2001 From: Ezinwa Okpoechi Date: Thu, 24 May 2018 11:47:10 +0200 Subject: [PATCH] Justify header when there are decorations but no grid --- src/printer.rs | 2 ++ tests/snapshots/output/changes,header,numbers.snapshot.txt | 2 +- tests/snapshots/output/changes,header.snapshot.txt | 2 +- tests/snapshots/output/header,numbers.snapshot.txt | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index 912d0148..900d9206 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -90,6 +90,8 @@ impl<'a> Printer<'a> { .grid .paint(if self.panel_width > 0 { "│" } else { "" }), )?; + } else { + write!(self.handle, "{}", " ".repeat(self.panel_width))?; } writeln!( diff --git a/tests/snapshots/output/changes,header,numbers.snapshot.txt b/tests/snapshots/output/changes,header,numbers.snapshot.txt index 770987b0..77145eb9 100644 --- a/tests/snapshots/output/changes,header,numbers.snapshot.txt +++ b/tests/snapshots/output/changes,header,numbers.snapshot.txt @@ -1,4 +1,4 @@ -File: sample.rs + File: sample.rs 1 struct Rectangle { 2 width: u32, 3 height: u32, diff --git a/tests/snapshots/output/changes,header.snapshot.txt b/tests/snapshots/output/changes,header.snapshot.txt index 97956665..82fe8c47 100644 --- a/tests/snapshots/output/changes,header.snapshot.txt +++ b/tests/snapshots/output/changes,header.snapshot.txt @@ -1,4 +1,4 @@ -File: sample.rs + File: sample.rs struct Rectangle { width: u32, height: u32, diff --git a/tests/snapshots/output/header,numbers.snapshot.txt b/tests/snapshots/output/header,numbers.snapshot.txt index 3a0f9234..a681e6b4 100644 --- a/tests/snapshots/output/header,numbers.snapshot.txt +++ b/tests/snapshots/output/header,numbers.snapshot.txt @@ -1,4 +1,4 @@ -File: sample.rs + File: sample.rs 1 struct Rectangle { 2 width: u32, 3 height: u32,