Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Activate panes on _any_ click, not just left click
Browse files Browse the repository at this point in the history
  • Loading branch information
50Wliu authored and darangi committed Nov 6, 2020
1 parent 9a9f69a commit d941bcf
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/tab-bar-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@ class TabBarView
@pane.activatePreviousItem()

onMouseDown: (event) ->
@pane.activate() unless @pane.isDestroyed()

tab = @tabForElement(event.target)
return unless tab

if event.which is 3 or (event.which is 1 and event.ctrlKey is true)
@rightClickedTab?.element.classList.remove('right-clicked')
if event.button is 2 or (event.button is 0 and event.ctrlKey is true)
@rightClickedTab = tab
@rightClickedTab.element.classList.add('right-clicked')
event.preventDefault()
else if event.which is 2
else if event.button is 1
# This prevents Chromium from activating "scroll mode" when
# middle-clicking while some tabs are off-screen.
event.preventDefault()
Expand All @@ -440,14 +440,13 @@ class TabBarView
return unless tab

event.preventDefault()
if event.which is 3 or (event.which is 1 and event.ctrlKey is true)
if event.button is 2 or (event.button is 0 and event.ctrlKey is true)
# Bail out early when receiving this event, because we have already
# handled it in the mousedown handler.
return
else if event.which is 1 and not event.target.classList.contains('close-icon')
else if event.button is 0 and not event.target.classList.contains('close-icon')
@pane.activateItem(tab.item)
@pane.activate() unless @pane.isDestroyed()
else if event.which is 2
else if event.button is 1
@pane.destroyItem(tab.item)

onDoubleClick: (event) ->
Expand Down

2 comments on commit d941bcf

@khashayarnazari
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh pr checkout 531

@khashayarnazari
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.