From c36ed3281694375a5ee85b86c2c710073c1195dd Mon Sep 17 00:00:00 2001 From: Ethan P Date: Wed, 16 Dec 2020 18:10:29 -0800 Subject: [PATCH 01/11] Add --squeeze/-s option Co-authored-by: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> --- src/bin/bat/app.rs | 5 +++++ src/bin/bat/clap_app.rs | 8 ++++++++ src/config.rs | 3 +++ src/printer.rs | 14 ++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 8843d53b..58f683cd 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -290,6 +290,11 @@ impl App { #[cfg(feature = "lessopen")] use_lessopen: self.matches.get_flag("lessopen"), set_terminal_title: self.matches.get_flag("set-terminal-title"), + squeeze_lines: if self.matches.get_flag("squeeze") { + 1 + } else { + 0 + }, }) } diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index d3cb9276..4bcee8d6 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -387,6 +387,14 @@ pub fn build_app(interactive_output: bool) -> Command { .help("Display all supported highlighting themes.") .long_help("Display a list of supported themes for syntax highlighting."), ) + .arg( + Arg::new("squeeze") + .long("squeeze") + .short('s') + .action(ArgAction::SetTrue) + .help("Squeeze consecutive empty lines.") + .long_help("Squeeze consecutive empty lines into a single empty line.") + ) .arg( Arg::new("style") .long("style") diff --git a/src/config.rs b/src/config.rs index c5cc2abd..ee0d5bc1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -97,6 +97,9 @@ pub struct Config<'a> { // Weather or not to set terminal title when using a pager pub set_terminal_title: bool, + + /// The maximum number of consecutive empty lines to display + pub squeeze_lines: usize, } #[cfg(all(feature = "minimal-application", feature = "paging"))] diff --git a/src/printer.rs b/src/printer.rs index 8fd6bc8e..636c0800 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -187,6 +187,7 @@ pub(crate) struct InteractivePrinter<'a> { pub line_changes: &'a Option, highlighter_from_set: Option>, background_color_highlight: Option, + consecutive_empty_lines: usize, } impl<'a> InteractivePrinter<'a> { @@ -272,6 +273,7 @@ impl<'a> InteractivePrinter<'a> { line_changes, highlighter_from_set, background_color_highlight, + consecutive_empty_lines: 0, }) } @@ -577,6 +579,18 @@ impl<'a> Printer for InteractivePrinter<'a> { return Ok(()); } + // Skip squeezed lines. + if self.config.squeeze_lines > 0 { + 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 { + return Ok(()); + } + } else { + self.consecutive_empty_lines = 0; + } + } + let mut cursor: usize = 0; let mut cursor_max: usize = self.config.term_width; let mut cursor_total: usize = 0; From 0c7e5299bf05d24c22dbff85964acec26ea3edf4 Mon Sep 17 00:00:00 2001 From: Ethan P Date: Wed, 16 Dec 2020 18:16:00 -0800 Subject: [PATCH 02/11] Add squeeze_empty_lines to PrettyPrinter --- src/pretty_printer.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pretty_printer.rs b/src/pretty_printer.rs index 121637f1..614f0c91 100644 --- a/src/pretty_printer.rs +++ b/src/pretty_printer.rs @@ -230,6 +230,13 @@ impl<'a> PrettyPrinter<'a> { self } + /// Specify the maximum number of consecutive empty lines to print. + /// If set to `0`, all empty lines will be shown. + pub fn squeeze_empty_lines(&mut self, maximum: usize) -> &mut Self { + self.config.squeeze_lines = maximum; + self + } + /// Specify the highlighting theme pub fn theme(&mut self, theme: impl AsRef) -> &mut Self { self.config.theme = theme.as_ref().to_owned(); From 0e4e10edb6663b9ee73c850b9679b08929501c2f Mon Sep 17 00:00:00 2001 From: Ethan P Date: Wed, 16 Dec 2020 18:23:14 -0800 Subject: [PATCH 03/11] Add --squeeze-limit to specify max number of consecutive empty lines Co-authored-by: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> --- src/bin/bat/app.rs | 9 +++++++-- src/bin/bat/clap_app.rs | 7 +++++++ src/config.rs | 2 +- src/pretty_printer.rs | 3 +-- src/printer.rs | 4 ++-- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 58f683cd..f462ce8d 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -291,9 +291,14 @@ impl App { use_lessopen: self.matches.get_flag("lessopen"), set_terminal_title: self.matches.get_flag("set-terminal-title"), squeeze_lines: if self.matches.get_flag("squeeze") { - 1 + Some( + self.matches + .get_one::("squeeze-limit") + .map(|limit| limit.to_owned()) + .unwrap_or(1), + ) } else { - 0 + None }, }) } diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index 4bcee8d6..0c28ce7d 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -395,6 +395,13 @@ pub fn build_app(interactive_output: bool) -> Command { .help("Squeeze consecutive empty lines.") .long_help("Squeeze consecutive empty lines into a single empty line.") ) + .arg( + Arg::new("squeeze-limit") + .long("squeeze-limit") + .value_parser(|s: &str| s.parse::().map_err(|_| "Requires a non-negative number".to_owned())) + .help("The maximum number of consecutive empty lines.") + .long_help("Set the maximum number of consecutive empty lines to be printed.") + ) .arg( Arg::new("style") .long("style") diff --git a/src/config.rs b/src/config.rs index ee0d5bc1..0298bb2a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -99,7 +99,7 @@ pub struct Config<'a> { pub set_terminal_title: bool, /// The maximum number of consecutive empty lines to display - pub squeeze_lines: usize, + pub squeeze_lines: Option, } #[cfg(all(feature = "minimal-application", feature = "paging"))] diff --git a/src/pretty_printer.rs b/src/pretty_printer.rs index 614f0c91..c6203aa9 100644 --- a/src/pretty_printer.rs +++ b/src/pretty_printer.rs @@ -231,8 +231,7 @@ impl<'a> PrettyPrinter<'a> { } /// Specify the maximum number of consecutive empty lines to print. - /// If set to `0`, all empty lines will be shown. - pub fn squeeze_empty_lines(&mut self, maximum: usize) -> &mut Self { + pub fn squeeze_empty_lines(&mut self, maximum: Option) -> &mut Self { self.config.squeeze_lines = maximum; self } diff --git a/src/printer.rs b/src/printer.rs index 636c0800..343f4486 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -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 { From 9bb0271e7d800dab61556effa5a5ea92681e56be Mon Sep 17 00:00:00 2001 From: Ethan P Date: Wed, 16 Dec 2020 18:35:31 -0800 Subject: [PATCH 04/11] Update CHANGELOG.md (PR #1441) --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c95cf9f..b34ec99c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## Features - Set terminal title to file names when Paging is not Paging::Never #2807 (@Oliver-Looney) +- `bat --squeeze`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) +- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze`, see #1441 (@eth-p) +- `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) ## Bugfixes From 13204c46e2334b823d265a45c0dd6006c912f1ef Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Sun, 10 Sep 2023 13:38:26 +0200 Subject: [PATCH 05/11] Update short-help/long-help --- doc/long-help.txt | 6 ++++++ doc/short-help.txt | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/doc/long-help.txt b/doc/long-help.txt index 1aae60d8..1044bee9 100644 --- a/doc/long-help.txt +++ b/doc/long-help.txt @@ -116,6 +116,12 @@ Options: --list-themes Display a list of supported themes for syntax highlighting. + -s, --squeeze + Squeeze consecutive empty lines into a single empty line. + + --squeeze-limit + Set the maximum number of consecutive empty lines to be printed. + --style Configure which elements (line numbers, file headers, grid borders, Git modifications, ..) to display in addition to the file contents. The argument is a comma-separated list of diff --git a/doc/short-help.txt b/doc/short-help.txt index 118dbce2..3f19b94d 100644 --- a/doc/short-help.txt +++ b/doc/short-help.txt @@ -43,6 +43,10 @@ Options: Set the color theme for syntax highlighting. --list-themes Display all supported highlighting themes. + -s, --squeeze + Squeeze consecutive empty lines. + --squeeze-limit + The maximum number of consecutive empty lines. --style Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip). From 6c2ce631018e3ea838bed85d956df705d9c297a1 Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:28:35 +0200 Subject: [PATCH 06/11] Add squeeze functionality to `SimplePrinter` --- src/printer.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/printer.rs b/src/printer.rs index 343f4486..fc6c16f0 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -101,11 +101,15 @@ pub(crate) trait Printer { pub struct SimplePrinter<'a> { config: &'a Config<'a>, + consecutive_empty_lines: usize, } impl<'a> SimplePrinter<'a> { pub fn new(config: &'a Config) -> Self { - SimplePrinter { config } + SimplePrinter { + config, + consecutive_empty_lines: 0, + } } } @@ -134,6 +138,21 @@ impl<'a> Printer for SimplePrinter<'a> { _line_number: usize, line_buffer: &[u8], ) -> Result<()> { + // Skip squeezed lines. + if let Some(squeeze_limit) = self.config.squeeze_lines { + if String::from_utf8_lossy(line_buffer) + .trim_end_matches(|c| c == '\r' || c == '\n') + .is_empty() + { + self.consecutive_empty_lines += 1; + if self.consecutive_empty_lines > squeeze_limit { + return Ok(()); + } + } else { + self.consecutive_empty_lines = 0; + } + } + if !out_of_range { if self.config.show_nonprintable { let line = replace_nonprintable( From 2323aa0defe3f364bcd54ab662a12049141a322d Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:33:48 +0200 Subject: [PATCH 07/11] Add tests for `--squeeze` --- tests/examples/empty_lines.txt | 30 ++++++++++++++++ tests/integration_tests.rs | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/examples/empty_lines.txt diff --git a/tests/examples/empty_lines.txt b/tests/examples/empty_lines.txt new file mode 100644 index 00000000..8ec1fae8 --- /dev/null +++ b/tests/examples/empty_lines.txt @@ -0,0 +1,30 @@ +line 1 + + + +line 5 + + + + + + + + + + + + + + +line 20 +line 21 + + +line 24 + +line 26 + + + +line 30 diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 3612654b..4d595031 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -208,6 +208,70 @@ fn line_range_multiple() { .stdout("line 1\nline 2\nline 4\n"); } +#[test] +fn squeeze() { + bat() + .arg("empty_lines.txt") + .arg("--squeeze") + .assert() + .success() + .stdout("line 1\n\nline 5\n\nline 20\nline 21\n\nline 24\n\nline 26\n\nline 30\n"); +} + +#[test] +fn squeeze_line_numbers() { + bat() + .arg("empty_lines.txt") + .arg("--squeeze") + .arg("--decorations=always") + .arg("--number") + .assert() + .success() + .stdout(" 1 line 1\n 2 \n 5 line 5\n 6 \n 20 line 20\n 21 line 21\n 22 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 30 line 30\n"); +} + +#[test] +fn squeeze_limit() { + bat() + .arg("empty_lines.txt") + .arg("--squeeze") + .arg("--squeeze-limit=2") + .assert() + .success() + .stdout("line 1\n\n\nline 5\n\n\nline 20\nline 21\n\n\nline 24\n\nline 26\n\n\nline 30\n"); + + bat() + .arg("empty_lines.txt") + .arg("--squeeze") + .arg("--squeeze-limit=5") + .assert() + .success() + .stdout("line 1\n\n\n\nline 5\n\n\n\n\n\nline 20\nline 21\n\n\nline 24\n\nline 26\n\n\n\nline 30\n"); +} + +#[test] +fn squeeze_limit_line_numbers() { + bat() + .arg("empty_lines.txt") + .arg("--squeeze") + .arg("--squeeze-limit=2") + .arg("--decorations=always") + .arg("--number") + .assert() + .success() + .stdout(" 1 line 1\n 2 \n 3 \n 5 line 5\n 6 \n 7 \n 20 line 20\n 21 line 21\n 22 \n 23 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 28 \n 30 line 30\n"); + + bat() + .arg("empty_lines.txt") + .arg("--squeeze") + .arg("--squeeze-limit=5") + .arg("--decorations=always") + .arg("--number") + .assert() + .success() + .stdout(" 1 line 1\n 2 \n 3 \n 4 \n 5 line 5\n 6 \n 7 \n 8 \n 9 \n 10 \n 20 line 20\n 21 line 21\n 22 \n 23 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 28 \n 29 \n 30 line 30\n"); +} + #[test] #[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)] fn short_help() { From 1fbdbfc4b25b5e249d88b8405dbe98f3ea13972e Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:59:09 +0200 Subject: [PATCH 08/11] Update CHANGELOG --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b34ec99c..56e1e98e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,9 @@ ## Features - Set terminal title to file names when Paging is not Paging::Never #2807 (@Oliver-Looney) -- `bat --squeeze`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) -- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze`, see #1441 (@eth-p) -- `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) +- `bat --squeeze`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) +- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) +- `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) ## Bugfixes From f041ff8c5f986e9e83a85615df86cbaf90ac79e0 Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:57:44 +0100 Subject: [PATCH 09/11] Hide `--squeeze-limit` from short help --- doc/short-help.txt | 2 -- src/bin/bat/clap_app.rs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/short-help.txt b/doc/short-help.txt index 3f19b94d..52943465 100644 --- a/doc/short-help.txt +++ b/doc/short-help.txt @@ -45,8 +45,6 @@ Options: Display all supported highlighting themes. -s, --squeeze Squeeze consecutive empty lines. - --squeeze-limit - The maximum number of consecutive empty lines. --style Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip). diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index 0c28ce7d..cfb9d054 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -399,8 +399,8 @@ pub fn build_app(interactive_output: bool) -> Command { Arg::new("squeeze-limit") .long("squeeze-limit") .value_parser(|s: &str| s.parse::().map_err(|_| "Requires a non-negative number".to_owned())) - .help("The maximum number of consecutive empty lines.") .long_help("Set the maximum number of consecutive empty lines to be printed.") + .hide_short_help(true) ) .arg( Arg::new("style") From 83b00bc653130cfbcc75b4a3bbfb2ffe6af85d8e Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Sat, 24 Feb 2024 14:02:27 +0100 Subject: [PATCH 10/11] Rename `--squeeze` to `--squeeze-blank` --- doc/long-help.txt | 2 +- doc/short-help.txt | 2 +- src/bin/bat/app.rs | 2 +- src/bin/bat/clap_app.rs | 4 ++-- tests/integration_tests.rs | 16 ++++++++-------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/long-help.txt b/doc/long-help.txt index 1044bee9..a6ffe962 100644 --- a/doc/long-help.txt +++ b/doc/long-help.txt @@ -116,7 +116,7 @@ Options: --list-themes Display a list of supported themes for syntax highlighting. - -s, --squeeze + -s, --squeeze-blank Squeeze consecutive empty lines into a single empty line. --squeeze-limit diff --git a/doc/short-help.txt b/doc/short-help.txt index 52943465..305bbf3d 100644 --- a/doc/short-help.txt +++ b/doc/short-help.txt @@ -43,7 +43,7 @@ Options: Set the color theme for syntax highlighting. --list-themes Display all supported highlighting themes. - -s, --squeeze + -s, --squeeze-blank Squeeze consecutive empty lines. --style Comma-separated list of style elements to display (*default*, auto, full, plain, changes, diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index f462ce8d..c382975e 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -290,7 +290,7 @@ impl App { #[cfg(feature = "lessopen")] use_lessopen: self.matches.get_flag("lessopen"), set_terminal_title: self.matches.get_flag("set-terminal-title"), - squeeze_lines: if self.matches.get_flag("squeeze") { + squeeze_lines: if self.matches.get_flag("squeeze-blank") { Some( self.matches .get_one::("squeeze-limit") diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index cfb9d054..ac7f5c18 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -388,8 +388,8 @@ pub fn build_app(interactive_output: bool) -> Command { .long_help("Display a list of supported themes for syntax highlighting."), ) .arg( - Arg::new("squeeze") - .long("squeeze") + Arg::new("squeeze-blank") + .long("squeeze-blank") .short('s') .action(ArgAction::SetTrue) .help("Squeeze consecutive empty lines.") diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 4d595031..61537bee 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -209,20 +209,20 @@ fn line_range_multiple() { } #[test] -fn squeeze() { +fn squeeze_blank() { bat() .arg("empty_lines.txt") - .arg("--squeeze") + .arg("--squeeze-blank") .assert() .success() .stdout("line 1\n\nline 5\n\nline 20\nline 21\n\nline 24\n\nline 26\n\nline 30\n"); } #[test] -fn squeeze_line_numbers() { +fn squeeze_blank_line_numbers() { bat() .arg("empty_lines.txt") - .arg("--squeeze") + .arg("--squeeze-blank") .arg("--decorations=always") .arg("--number") .assert() @@ -234,7 +234,7 @@ fn squeeze_line_numbers() { fn squeeze_limit() { bat() .arg("empty_lines.txt") - .arg("--squeeze") + .arg("--squeeze-blank") .arg("--squeeze-limit=2") .assert() .success() @@ -242,7 +242,7 @@ fn squeeze_limit() { bat() .arg("empty_lines.txt") - .arg("--squeeze") + .arg("--squeeze-blank") .arg("--squeeze-limit=5") .assert() .success() @@ -253,7 +253,7 @@ fn squeeze_limit() { fn squeeze_limit_line_numbers() { bat() .arg("empty_lines.txt") - .arg("--squeeze") + .arg("--squeeze-blank") .arg("--squeeze-limit=2") .arg("--decorations=always") .arg("--number") @@ -263,7 +263,7 @@ fn squeeze_limit_line_numbers() { bat() .arg("empty_lines.txt") - .arg("--squeeze") + .arg("--squeeze-blank") .arg("--squeeze-limit=5") .arg("--decorations=always") .arg("--number") From bc5beaec5da357f5cf44e468079d11ec3174b828 Mon Sep 17 00:00:00 2001 From: David Peter Date: Sat, 24 Feb 2024 20:36:08 +0100 Subject: [PATCH 11/11] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56e1e98e..613fb8b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,8 @@ ## Features - Set terminal title to file names when Paging is not Paging::Never #2807 (@Oliver-Looney) -- `bat --squeeze`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) -- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) +- `bat --squeeze-blank`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) +- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze-blank`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) - `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) ## Bugfixes