Only handle the left mouse button (and middle on Linux)

This commit is contained in:
Nathan Sobo
2017-03-10 20:22:43 -07:00
committed by Antonio Scandurra
parent 35ae3fb08f
commit 17d579f949
2 changed files with 42 additions and 14 deletions

View File

@@ -760,9 +760,13 @@ class TextEditorComponent {
didMouseDownOnContent (event) {
const {model} = this.props
const {detail, ctrlKey, shiftKey, metaKey} = event
const screenPosition = this.screenPositionForMouseEvent(event)
const {button, detail, ctrlKey, shiftKey, metaKey} = event
// Only handle mousedown events for left mouse button (or the middle mouse
// button on Linux where it pastes the selection clipboard).
if (!(button === 0 || (this.getPlatform() === 'linux' && button === 1))) return
const screenPosition = this.screenPositionForMouseEvent(event)
const addOrRemoveSelection = metaKey || (ctrlKey && this.getPlatform() !== 'darwin')
switch (detail) {