From ebe9835e5ace74c28ab218278a8537e23c7bf845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=BCrmann?= Date: Thu, 29 Oct 2015 00:22:54 +0100 Subject: [PATCH 1/4] Remove unused tab on undo --- qutebrowser/mainwindow/tabbedbrowser.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 4d24b3960..1c368067d 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -301,6 +301,23 @@ class TabbedBrowser(tabwidget.TabWidget): def undo(self): """Undo removing of a tab.""" + + # Remove unused tab which may be created after the last tab is closed + last_close = config.get('tabs', 'last-close') + if last_close in ['blank', 'startpage', 'default-page']: + only_one_tab_open = self.count() == 1 + no_history = self.widget(0).history().count() == 1 + urls = { + 'blank': QUrl('about:blank'), + 'startpage': QUrl(config.get('general', 'startpage')[0]), + 'default-page': config.get('general', 'default-page'), + } + first_tab_url = self.widget(0).url() + last_close_url_used = first_tab_url == urls[last_close] + + if only_one_tab_open and no_history and last_close_url_used: + self.removeTab(0) + url, history_data = self._undo_stack.pop() newtab = self.tabopen(url, background=False) qtutils.deserialize(history_data, newtab.history()) From 618d9ceabfebb7636c0c80cd65bd4ccb9af64f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=BCrmann?= Date: Thu, 29 Oct 2015 00:52:44 +0100 Subject: [PATCH 2/4] Fix PEP 257 violation --- qutebrowser/mainwindow/tabbedbrowser.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 1c368067d..bfd036186 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -301,7 +301,6 @@ class TabbedBrowser(tabwidget.TabWidget): def undo(self): """Undo removing of a tab.""" - # Remove unused tab which may be created after the last tab is closed last_close = config.get('tabs', 'last-close') if last_close in ['blank', 'startpage', 'default-page']: From a4aacde88fd0bd31936541951e967e7090938b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=BCrmann?= Date: Thu, 29 Oct 2015 09:36:42 +0100 Subject: [PATCH 3/4] Undo: Fix issues with url comparison --- qutebrowser/mainwindow/tabbedbrowser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index bfd036186..a44534863 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -311,8 +311,10 @@ class TabbedBrowser(tabwidget.TabWidget): 'startpage': QUrl(config.get('general', 'startpage')[0]), 'default-page': config.get('general', 'default-page'), } - first_tab_url = self.widget(0).url() - last_close_url_used = first_tab_url == urls[last_close] + first_tab_url = self.widget(0).page().mainFrame().requestedUrl() + last_close_urlstr = urls[last_close].toString().rstrip('/') + first_tab_urlstr = first_tab_url.toString().rstrip('/') + last_close_url_used = first_tab_urlstr == last_close_urlstr if only_one_tab_open and no_history and last_close_url_used: self.removeTab(0) From 4c031979842a540bee675322994f0859f01da37d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 30 Oct 2015 18:50:15 +0100 Subject: [PATCH 4/4] Regenerate authors. --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 72a67cc92..55ac53b0a 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -153,12 +153,12 @@ Contributors, sorted by the number of commits in descending order: * ZDarian * John ShaggyTwoDope Jenkins * Peter Vilim +* Jonas Schürmann * Jimmy * Zach-Button * rikn00 * Patric Schmitz * Martin Zimmermann -* Jonas Schürmann * Error 800 * Brian Jackson * sbinix