summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2020-04-21 16:15:02 +0200
committersharkdp <davidpeter@web.de>2020-04-21 16:15:02 +0200
commit5f6e310152f45f5a90a8e4b7312e85ec284745db (patch)
treeb5a98391b42c10a74ca77bf8098404d0042b5e82
parent5449472f15e4b5f063f9933fe426c8d3138bfa45 (diff)
Only enable --mouse when running from tmux, see #904
-rw-r--r--src/output.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/output.rs b/src/output.rs
index c8c44fbb..41a9a50e 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -100,12 +100,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");
+ // The '--mouse' argument is only supported in less 551 or higher. We do
+ // not enable this option everywhere because it prevents users from
+ // drag-selecting text without pressing shift.
+ if env::var_os("TMUX").is_some() {
+ match less_version {
+ Some(version) if version >= 551 => {
+ p.arg("--mouse");
+ }
+ _ => {}
}
- _ => {}
}
} else {
p.args(args);