1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-06-25 14:22:54 +02:00

grep-matcher: add LineTerminator::is_suffix

This centralizes the logic for checking whether a line has a line
terminator or not.
This commit is contained in:
Andrew Gallant
2018-09-07 11:56:30 -04:00
parent b8f619d16e
commit 56e8864426
2 changed files with 11 additions and 1 deletions

View File

@ -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 {