Skip to content

Commit

Permalink
Fix focus switch on close tab
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannQDQ authored and nyalldawson committed Mar 3, 2023
1 parent fc3847d commit 43c415d
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions python/console/console_editor.py
Expand Up @@ -767,20 +767,7 @@ def _removeTab(self, tab, tab2index=False):
self.removeTab(tab)

editorTab.deleteLater()
self.currentWidget().setFocus(Qt.TabFocusReason)

def buttonClosePressed(self):
self.closeCurrentWidget()

def closeCurrentWidget(self):
currWidget = self.currentWidget()
if currWidget and currWidget.close():
self.removeTab(self.currentIndex())
currWidget = self.currentWidget()
if currWidget:
currWidget.setFocus(Qt.TabFocusReason)
if currWidget.path in self.restoreTabList:
self.parent.updateTabListScript(currWidget.path, action='remove')
self.currentWidget()._editor.setFocus(Qt.TabFocusReason)

def restoreTabsOrAddNew(self):
"""
Expand Down Expand Up @@ -812,7 +799,7 @@ def restoreTabs(self):
self.newTabEditor(filename=None)
self.topFrame.close()
self.enableToolBarEditor(True)
self.currentWidget().setFocus(Qt.TabFocusReason)
self.currentWidget()._editor.setFocus(Qt.TabFocusReason)

def closeRestore(self):
self.parent.updateTabListScript(None)
Expand Down

0 comments on commit 43c415d

Please sign in to comment.