1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-09 14:52:25 +01:00

Add --squeeze-limit to specify max number of consecutive empty lines

Co-authored-by: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com>
This commit is contained in:
Ethan P
2020-12-16 18:23:14 -08:00
committed by einfachIrgendwer0815
parent 0c7e5299bf
commit 0e4e10edb6
5 changed files with 18 additions and 7 deletions

View File

@@ -580,10 +580,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
}
// Skip squeezed lines.
if self.config.squeeze_lines > 0 {
if let Some(squeeze_limit) = self.config.squeeze_lines {
if line.trim_end_matches(|c| c == '\r' || c == '\n').is_empty() {
self.consecutive_empty_lines += 1;
if self.consecutive_empty_lines > self.config.squeeze_lines {
if self.consecutive_empty_lines > squeeze_limit {
return Ok(());
}
} else {