@@ -82,11 +82,13 @@ impl OutputType {
8282 p.arg("--quit-if-one-screen");
8383 }
8484
85+ let less_version = retrieve_less_version();
86+
8587 // Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older
8688 // versions of 'less'. Unfortunately, it also breaks mouse-wheel support.
8789 //
8890 // See: http://www.greenwoodsoftware.com/less/news.530.html
89− match retrieve_less_version() {
91+ match less_version {
9092 None => {
9193 p.arg("--no-init");
9294 }
@@ -95,6 +97,16 @@ impl OutputType {
9597 }
9698 _ => {}
9799 }
100+
101+ // Passing '--mouse' allows mouse scrolling in terminals which do not
102+ // support "fake scrolling", see https://github.com/sharkdp/bat/issues/904
103+ // The '--mouse' argument is only supported in less 551 or higher.
104+ match less_version {
105+ Some(version) if version >= 551 => {
106+ p.arg("--mouse");
107+ }
108+ _ => {}
109+ }
98110 } else {
99111 p.args(args);
100112 }