From 71fee12b5b75d62bd22db464ec60c248a585255d Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Thu, 16 Jul 2015 15:26:15 +0200 Subject: [PATCH 1/2] Always remove the last tab, instead of opening a new page in it. IMHO this makes much more sense; for example, if you close the last tab but then press u to "undo" it, you'll actually load the second-last tab. To undo you need H for "back". Other things like gC, session save, etc. also behave in a way that is, IMHO, unexpected... I can also make a new option out of this, if you prefer. But I don't think that many people would expect the current behaviour... --- qutebrowser/mainwindow/tabbedbrowser.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 7b4d84b7b..60ba98681 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -234,17 +234,17 @@ 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'), True) + elif last_close == 'startpage': + self.openurl(QUrl(config.get('general', 'startpage')[0]), True) + elif last_close == 'default-page': + self.openurl(config.get('general', 'default-page'), True) def _remove_tab(self, tab): """Remove a tab from the tab list and delete it properly. From 5f10a12be9716c62299c70ca16be50fd26ec802c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 17 Jul 2015 06:39:53 +0200 Subject: [PATCH 2/2] Use keyword argument for newtab. --- qutebrowser/mainwindow/tabbedbrowser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 60ba98681..69de42dc9 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -240,11 +240,13 @@ class TabbedBrowser(tabwidget.TabWidget): if last_close == 'close': self.close_window.emit() elif last_close == 'blank': - self.openurl(QUrl('about:blank'), True) + self.openurl(QUrl('about:blank'), newtab=True) elif last_close == 'startpage': - self.openurl(QUrl(config.get('general', 'startpage')[0]), True) + url = QUrl(config.get('general', 'startpage')[0]) + self.openurl(url, newtab=True) elif last_close == 'default-page': - self.openurl(config.get('general', 'default-page'), True) + 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.