Skip to content

Commit

Permalink
Merge pull request #15490 from impact27/fix_tab
Browse files Browse the repository at this point in the history
PR: Fixes the selected tab when right clicking
  • Loading branch information
ccordoba12 committed May 23, 2021
2 parents d2c8392 + 15d2904 commit 2373812
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions spyder/widgets/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,11 @@ def get_offset_pos(self, event):
Add offset to position event to capture the mouse cursor
inside a tab.
"""
# This is necessary because self.tabBar().tabAt(event.pos()) is not
# returning the expected index. For further information see
# spyder-ide/spyder#12617
point = event.pos()
if sys.platform == 'darwin':
# The close button on tab is on the left
point.setX(point.x() + 3)
else:
# The close button on tab is on the right
point.setX(point.x() - 30)
return self.tabBar().tabAt(point)
# This is necessary because event.pos() is the position in this
# widget, not in the tabBar. see spyder-ide/spyder#12617
tb = self.tabBar()
point = tb.mapFromGlobal(event.globalPos())
return tb.tabAt(point)

def contextMenuEvent(self, event):
"""Override Qt method"""
Expand Down

0 comments on commit 2373812

Please sign in to comment.