summaryrefslogtreecommitdiffstats
path: root/src/output.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/output.rs')
-rw-r--r--src/output.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/output.rs b/src/output.rs
index 15f29e43..c8c44fbb 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -82,11 +82,13 @@ impl OutputType {
p.arg("--quit-if-one-screen");
}
+ let less_version = retrieve_less_version();
+
// Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older
// versions of 'less'. Unfortunately, it also breaks mouse-wheel support.
//
// See: http://www.greenwoodsoftware.com/less/news.530.html
- match retrieve_less_version() {
+ match less_version {
None => {
p.arg("--no-init");
}
@@ -95,6 +97,16 @@ impl OutputType {
}
_ => {}
}
+
+ // Passing '--mouse' allows mouse scrolling in terminals which do not
+ // support "fake scrolling", see https://github.com/sharkdp/bat/issues/904
+ // The '--mouse' argument is only supported in less 551 or higher.
+ match less_version {
+ Some(version) if version >= 551 => {
+ p.arg("--mouse");
+ }
+ _ => {}
+ }
} else {
p.args(args);
}