-
Notifications
You must be signed in to change notification settings - Fork 121
[Linux][1.19.0-beta1] Closing tab with middle mouse pastes in next tab #461
Comments
Most likely caused by the Electron upgrade; specifically the underlying changes to how Chrome handles middle-button-paste on Linux. |
I'm able to repro this issue with the repro steps provided. |
This looks related to electron upgrade as it also caused regression with double pasting on middle clicking(atom/atom#8648) that was fixed with atom/atom#14987. |
Is there a hotfix for this ? I keep pasting everywhere on closing tabs ... |
I've been playing around in dev mode tab-bar-view.js TabBarView.prototype.onMouseDown = function(event) {
var ref, tab;
tab = this.tabForElement(event.target);
if (!tab) {
return;
}
if (event.which === 3 || (event.which === 1 && event.ctrlKey === true)) {
if ((ref = this.rightClickedTab) != null) {
ref.element.classList.remove('right-clicked');
}
this.rightClickedTab = tab;
this.rightClickedTab.element.classList.add('right-clicked');
return event.preventDefault();
} else if (event.which === 1 && !event.target.classList.contains('close-icon')) {
return setImmediate((function(_this) {
return function() {
_this.pane.activateItem(tab.item);
if (!_this.pane.isDestroyed()) {
return _this.pane.activate();
}
};
})(this));
} else if (event.which === 2) {
this.pane.destroyItem(tab.item);
// return event.preventDefault(); // <====== comment
return false; // <====== added
}
}; so a patch on atom/tabs could be something like diff --git a/lib/tab-bar-view.coffee b/lib/tab-bar-view.coffee
index eb5a2c2..0bcf6a5 100644
--- a/lib/tab-bar-view.coffee
+++ b/lib/tab-bar-view.coffee
@@ -415,7 +415,8 @@ class TabBarView
@pane.activate() unless @pane.isDestroyed()
else if event.which is 2
@pane.destroyItem(tab.item)
- event.preventDefault()
+ # event.preventDefault()
+ false
onDoubleClick: (event) ->
if tab = @tabForElement(event.target) can anyone try this (i'm on atom-beta7 btw) ? |
Can confirm that this also worked for 1.19.0-beta4 |
On Linux, when the user performs a middle-button mouse click, Chromium fires both a mouse-down event *and* a paste event. This commit teaches the TextEditorComponent to ignore the paste event. When the user performs a middle-mouse click on a tab, we get close the tab and attempt to prevent Chromium's default processing for the event. [1] This prevents Chromium's default processing for the *mouse down* event, but then Chromium also fires a *paste* event, and that event pastes the clipboard's current content into the newly-focused text editor. 🙀 Since Atom already has its own logic for handling pasting, we shouldn't (🤞) need to handle browser paste events. By ignoring the browser paste events on Linux, we fix atom/tabs#461. [1] https://github.com/atom/tabs/blob/ce1d92e0abb669155caa178bb71166b9f16f329a/lib/tab-bar-view.coffee#L416-L418
On Linux, when the user performs a middle-button mouse click, Chromium fires both a mouse-down event *and* a paste event. This commit teaches the TextEditorComponent to ignore the paste event. When the user performs a middle-mouse click on a tab, we get close the tab and attempt to prevent Chromium's default processing for the event. [1] This prevents Chromium's default processing for the *mouse down* event, but then Chromium also fires a *paste* event, and that event pastes the clipboard's current content into the newly-focused text editor. 🙀 Since Atom already has its own logic for handling pasting, we shouldn't (🤞) need to handle browser paste events. By ignoring the browser paste events on Linux, we fix atom/tabs#461. [1] https://github.com/atom/tabs/blob/ce1d92e0abb669155caa178bb71166b9f16f329a/lib/tab-bar-view.coffee#L416-L418
Prerequisites
Description
Same as #52, but this time I'm unable to reproduce this on 1.18, but able on 1.19.
Steps to Reproduce
Make sure you have something in the clipboard.
Expected behavior: The tab should just be closed.
Actual behavior: Tab closes and content from my clipboard is pasted.
Reproduces how often: Always
Versions
1.18:
1.19:
Additional Information
Related to #52
The text was updated successfully, but these errors were encountered: