on master help sign in
Only enable --mouse when running from tmux, see #904
5f6e310sharkdp
src/output.rs+9−5
@@ -100,12 +100,16 @@ impl OutputType {
100
100
101 // Passing '--mouse' allows mouse scrolling in terminals which do not
101 // Passing '--mouse' allows mouse scrolling in terminals which do not
102 // support "fake scrolling", see https://github.com/sharkdp/bat/issues/904
102 // support "fake scrolling", see https://github.com/sharkdp/bat/issues/904
103− // The '--mouse' argument is only supported in less 551 or higher.
103+ // The '--mouse' argument is only supported in less 551 or higher. We do
104+ // not enable this option everywhere because it prevents users from
105+ // drag-selecting text without pressing shift.
106+ if env::var_os("TMUX").is_some() {
104− match less_version {
107+ match less_version {
105− Some(version) if version >= 551 => {
108+ Some(version) if version >= 551 => {
106− p.arg("--mouse");
109+ p.arg("--mouse");
110+ }
111+ _ => {}
107 }
112 }
108− _ => {}
109 }
113 }
110 } else {
114 } else {
111 p.args(args);
115 p.args(args);