diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-03-31 14:16:05 +0200 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2018-05-05 08:10:57 -0700 |
commit | 5be0e3ad8fcde5d8dec98c0e71a2b495294d03be (patch) | |
tree | 485729a4fb4cedcc6c33a7d6dce42f6729a37bcf | |
parent | e2abd8945ad219e9749d4f16e0d1ceed013f0058 (diff) | |
download | alacritty-5be0e3ad8fcde5d8dec98c0e71a2b495294d03be.tar.gz alacritty-5be0e3ad8fcde5d8dec98c0e71a2b495294d03be.zip |
Don't paste selection when in mouse mode
When the mouse mode is set using either 1000h, 1002h or 1003h, the
selection should not be pasted when hitting the middle mouse button,
because it is job of the application to handle this when mouse mode is
enabled.
This has been solved by checking for the current mouse modes whenever
the `PasteSelection` binding is invoked.
This fixes #1215.
-rw-r--r-- | src/input.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/input.rs b/src/input.rs index d831affc..2d603783 100644 --- a/src/input.rs +++ b/src/input.rs @@ -191,12 +191,16 @@ impl Action { }); }, Action::PasteSelection => { - Clipboard::new() - .and_then(|clipboard| clipboard.load_selection() ) - .map(|contents| { self.paste(ctx, contents) }) - .unwrap_or_else(|err| { - warn!("Error loading data from clipboard. {}", Red(err)); - }); + // Only paste if mouse events are not captured by an application + let mouse_modes = TermMode::MOUSE_REPORT_CLICK | TermMode::MOUSE_DRAG | TermMode::MOUSE_MOTION; + if !ctx.terminal_mode().intersects(mouse_modes) { + Clipboard::new() + .and_then(|clipboard| clipboard.load_selection() ) + .map(|contents| { self.paste(ctx, contents) }) + .unwrap_or_else(|err| { + warn!("Error loading data from clipboard. {}", Red(err)); + }); + } }, Action::Command(ref program, ref args) => { trace!("running command: {} {:?}", program, args); |