on master help sign in
Only enable --mouse when running from tmux, see #904
commit5f6e310152f45f5a90a8e4b7312e85ec284745db authorsharkdp <davidpeter@web.de> dateTue 21 Apr 2020, 16:15 (7 years ago) parent5449472
1 file changed+9−5
src/output.rs+9−5
src/output.rs+9−5
@@ -100,12 +100,16 @@ impl OutputType {
100100
101101 // Passing '--mouse' allows mouse scrolling in terminals which do not
102102 // 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");
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() {
107+ match less_version {
108+ Some(version) if version >= 551 => {
109+ p.arg("--mouse");
110+ }
111+ _ => {}
107112 }
108− _ => {}
109113 }
110114 } else {
111115 p.args(args);