@@ -117,67 +117,59 @@ impl<'a> Printer<'a> {
117117 let border = if gutter_width > 0 && self.config.output_components.grid() {
118118 self.gen_border()
119119 } else {
120− PrintSegment {
121− size: 0,
122− text: "".to_owned(),
123− }
124− };
125−
126− cursor_max -= border.size;
127− write!(self.handle, "{} ", border.text)?;
128−
129− // Line contents.
130− for &(style, text) in regions.iter() {
131− let mut chars = text.chars().filter(|c| *c != '\n');
132− let mut remaining = text.chars().filter(|c| *c != '\n').count();
133−
134− while remaining > 0 {
135− let available = cursor_max - cursor;
136−
137− // It fits.
138− if remaining <= available {
139− let text = chars.by_ref().take(remaining).collect::<String>();
140− cursor += remaining;
141−
142− write!(
143− self.handle,
144− "{}",
145− as_terminal_escaped(
146− style,
147− &*text,
148− self.config.true_color,
149− self.config.colored_output
150− )
151− )?;
152− break;
153− }
154−
155− // It wraps.
156− if self.config.output_wrap == OutputWrap::Character {
157− let text = chars.by_ref().take(available).collect::<String>();
158− cursor = 0;
159− remaining -= available;
160−
161− write!(
162− self.handle,
163− "{}\n{}{} ",
164− as_terminal_escaped(
165− style,
166− &*text,
167− self.config.true_color,
168− self.config.colored_output
169− ),
170− " ".repeat(gutter_width),
171− border.text.to_owned()
172− )?;
173−
174− continue;
120+ for &(style, text) in regions.iter() {
121+ let mut chars = text.chars().filter(|c| *c != '\n');
122+ let mut remaining = text.chars().filter(|c| *c != '\n').count();
123+
124+ while remaining > 0 {
125+ let available = cursor_max - cursor;
126+
127+ // It fits.
128+ if remaining <= available {
129+ let text = chars.by_ref().take(remaining).collect::<String>();
130+ cursor += remaining;
131+
132+ write!(
133+ self.handle,
134+ "{}",
135+ as_terminal_escaped(
136+ style,
137+ &*text,
138+ self.config.true_color,
139+ self.config.colored_output
140+ )
141+ )?;
142+ break;
143+ }
144+
145+ // It wraps.
146+ if self.config.output_wrap == OutputWrap::Character {
147+ let text = chars.by_ref().take(available).collect::<String>();
148+ cursor = 0;
149+ remaining -= available;
150+
151+ write!(
152+ self.handle,
153+ "{}\n{}{}",
154+ as_terminal_escaped(
155+ style,
156+ &*text,
157+ self.config.true_color,
158+ self.config.colored_output
159+ ),
160+ " ".repeat(gutter_width),
161+ border.text.to_owned()
162+ )?;
163+
164+ continue;
165+ }
175166 }
176167 }
168+
169+ write!(self.handle, "\n")?;
177170 }
178171
179172 // Finished.
180− write!(self.handle, "\n")?;
181173 Ok(())
182174 }
183175
@@ -230,8 +222,8 @@ impl<'a> Printer<'a> {
230222 /// Generates the vertical grid border.
231223 fn gen_border(&self) -> PrintSegment {
232224 return PrintSegment {
233− text: self.colors.grid.paint("│").to_string(),
234− size: 1,
225+ text: self.colors.grid.paint("│ ").to_string(),
226+ size: 2,
235227 };
236228 }
237229