This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Fix regression re: closing tabs via middle mouse click on Linux #15183
Merged
jasonrudolph
merged 4 commits into
master
from
jr-is-there-anything-a-middle-click-CANT-do
Aug 7, 2017
Merged
Fix regression re: closing tabs via middle mouse click on Linux #15183
jasonrudolph
merged 4 commits into
master
from
jr-is-there-anything-a-middle-click-CANT-do
Aug 7, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
jasonrudolph
commented
Aug 7, 2017
src/text-editor-component.js
Outdated
@@ -1549,6 +1551,11 @@ class TextEditorComponent { | |||
} | |||
} | |||
|
|||
didPaste (event) { | |||
// TODO Explain the motivation for this logic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll resolve this TODO before merging this PR.
Wasn't that fixed some weeks ago? |
@alexandernst, the fix that went in 2 weeks ago was regarding middle clicking pasting twice(#14987) which is a different issue than Closing tab with middle mouse pastes in next tab(atom/tabs#461) |
@ungb: I think this is ready to 🚀. Wanna take it for a spin before I merge? |
/fyi @nathansobo: Just a courtesy ping in case you're interested in reviewing this PR. If so, I certainly welcome it, but please don't feel obligated. 🙇 |
nathansobo
approved these changes
Aug 7, 2017
jasonrudolph
added a commit
that referenced
this pull request
Aug 7, 2017
…ck-CANT-do Fix regression re: closing tabs via middle mouse click on Linux
jasonrudolph
added a commit
that referenced
this pull request
Aug 7, 2017
…ck-CANT-do Fix regression re: closing tabs via middle mouse click on Linux
1 task
Open
1 task
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes atom/tabs#461
Fixes atom/tabs#52
On Linux, when the user performs a middle-button mouse click, Chromium fires both a
mousedown
event and apaste
event. This PR teaches theTextEditorComponent
to ignore thepaste
event.When the user performs a middle-mouse click on a tab, we first get the
mousedown
event. In response to that event, we close the tab and attempt to prevent Chromium's default processing for the event. This prevents Chromium's default processing for themousedown
event, but then Chromium also fires apaste
event, and that event pastes the clipboard's current content into the newly-focused text editor. 🤦#14987 removed some of the middle-button mouse click handling related to pasting on Linux. This PR restores that logic and the related tests. (See
TextEditorComponent::didMouseDownOnContent(event)
.) With that change in place, since Atom already has its own logic for handling pasting, we shouldn't need to handle browserpaste
events. By ignoring the browserpaste
events on Linux, this PR fixes atom/tabs#461.TODO
TextEditorComponent::didPaste(event)
TextEditorComponent::didPaste(event)
(Fix regression re: closing tabs via middle mouse click on Linux #15183 (comment))Test plan