mirror of
https://github.com/sharkdp/bat
synced 2026-07-25 17:21:43 +00:00
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
This commit is contained in:
+6
-1
@@ -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");
|
||||
}
|
||||
_ => {}
|
||||
|
||||
Reference in New Issue
Block a user