summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2020-04-21 18:01:18 +0200
committersharkdp <davidpeter@web.de>2020-04-21 18:18:03 +0200
commit864656bd11d4f96235408e026f7ac68d86995919 (patch)
tree67349c89dcaee74fe5f3f5d9651540d794ab0446
parent2e9cf63a5fd63bd5bcf16cfce67b5999042b89cb (diff)
Pass --no-init on Windows if less version < 559
We used to call `less` with ``` bash less --RAW-CONTROL-CHARS --quit-if-one-screen --no-init ``` We only passed `--no-init` because there was a bug with previous versions of `less` which required the use of `--no-init` in combination with `--quit-if-one-screen` to prevent this "no output" issue from happening. Since bat 0.13, [we omit the `--no-init` option](https://github.com/sharkdp/bat/blob/0ecc94956b88beed27ca13a130c8ba09f1a220d8/src/output.rs#L85-L97) if we can detect that the version of `less` is higher than or equal to 530. We did that because `--no-init` breaks mouse support and because [less 530 fixed the above-mentioned bug](http://www.greenwoodsoftware.com/less/news.530.html). However, it seems that this bug was *not* fixed on Windows! According to @gwsw, the issue should be fixed with less 559 on Windows. closes #887
-rw-r--r--src/output.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/output.rs b/src/output.rs
index 15f29e43..0cfed062 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -86,11 +86,16 @@ impl OutputType {
// versions of 'less'. Unfortunately, it also breaks mouse-wheel support.
//
// See: http://www.greenwoodsoftware.com/less/news.530.html
+ //
+ // For newer versions (530 or 558 on Windows), we omit '--no-init' as it
+ // is not needed anymore.
match retrieve_less_version() {
None => {
p.arg("--no-init");
}
- Some(version) if version < 530 => {
+ Some(version)
+ if (version < 530 || (cfg!(windows) && version < 558)) =>
+ {
p.arg("--no-init");
}
_ => {}