grep-printer: fix bug in printing truncated lines

When emitting color, the printer wasn't checking whether the line
exceeded the maximum allowed length.
This commit is contained in:
Andrew Gallant 2018-08-21 20:53:21 -04:00
parent 5b1ce8bdc2
commit 74a89be641

View File

@ -1201,6 +1201,9 @@ impl<'a, M: Matcher, W: WriteColor> StandardImpl<'a, M, W> {
if !self.wtr().borrow().supports_color() || spec.is_none() {
return self.write_line(line);
}
if self.exceeds_max_columns(line) {
return self.write_exceeded_line();
}
let mut last_written =
if !self.config().trim_ascii {