diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 7b4d84b7b..69de42dc9 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -234,17 +234,19 @@ class TabbedBrowser(tabwidget.TabWidget): tab: The QWebView to be closed. """ last_close = config.get('tabs', 'last-close') - if self.count() > 1: - self._remove_tab(tab) - elif last_close == 'close': - self._remove_tab(tab) - self.close_window.emit() - elif last_close == 'blank': - tab.openurl(QUrl('about:blank')) - elif last_close == 'startpage': - tab.openurl(QUrl(config.get('general', 'startpage')[0])) - elif last_close == 'default-page': - tab.openurl(config.get('general', 'default-page')) + self._remove_tab(tab) + + if self.count() == 0: + if last_close == 'close': + self.close_window.emit() + elif last_close == 'blank': + self.openurl(QUrl('about:blank'), newtab=True) + elif last_close == 'startpage': + url = QUrl(config.get('general', 'startpage')[0]) + self.openurl(url, newtab=True) + elif last_close == 'default-page': + url = config.get('general', 'default-page') + self.openurl(url, newtab=True) def _remove_tab(self, tab): """Remove a tab from the tab list and delete it properly.