Skip to content

Instantly share code, notes, and snippets.

@nowrep
Created March 12, 2014 22:06
Show Gist options
  • Select an option

  • Save nowrep/9517483 to your computer and use it in GitHub Desktop.

Select an option

Save nowrep/9517483 to your computer and use it in GitHub Desktop.
diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp
index 22fe26e..d6e922e 100644
--- a/src/lib/webview/tabwidget.cpp
+++ b/src/lib/webview/tabwidget.cpp
@@ -481,10 +481,14 @@ void TabWidget::closeTab(int index, bool force)
// This would close last tab, so we close the window instead
if (!force && count() == 1) {
- // But only if we can
+ // If we are not closing window upon closing last tab, let's just load new-tab-url
if (m_dontCloseWithOneTab) {
- // We won't actually close the tab
- m_closedTabsManager->takeLastClosedTab();
+ if (webView->url() == m_urlOnNewTab) {
+ // We don't want to accumulate more than one closed tab, if user tries
+ // to close the last tab multiple times
+ m_closedTabsManager->takeLastClosedTab();
+ }
+ webView->load(m_urlOnNewTab);
return;
}
m_window->close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment