summaryrefslogtreecommitdiffstats
path: root/grep-printer
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-09-07 11:56:30 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-09-07 12:06:04 -0400
commit56e8864426229de7b181c141baddf788c22b4925 (patch)
treeb46d71c5ac47d185abdfc2d26058dba25b625a19 /grep-printer
parentb8f619d16ef82f2d9e77374f8db762318c0a2bf6 (diff)
grep-matcher: add LineTerminator::is_suffix
This centralizes the logic for checking whether a line has a line terminator or not.
Diffstat (limited to 'grep-printer')
-rw-r--r--grep-printer/src/standard.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/grep-printer/src/standard.rs b/grep-printer/src/standard.rs
index 183fa4b5..6c8976b8 100644
--- a/grep-printer/src/standard.rs
+++ b/grep-printer/src/standard.rs
@@ -1396,7 +1396,7 @@ impl<'a, M: Matcher, W: WriteColor> StandardImpl<'a, M, W> {
}
fn has_line_terminator(&self, buf: &[u8]) -> bool {
- buf.last() == Some(&self.searcher.line_terminator().as_byte())
+ self.searcher.line_terminator().is_suffix(buf)
}
fn is_context(&self) -> bool {