summaryrefslogtreecommitdiff
path: root/qutebrowser/browser/commands.py
diff options
context:
space:
mode:
authorTim Gadanidis <tim@gadanidis.ca>2021-11-01 22:18:46 -0400
committerTim Gadanidis <tim@gadanidis.ca>2021-11-01 22:18:46 -0400
commit5e5c778b4a1418bc4f06cf78885b8a895f5cf720 (patch)
treec13e5de99d7241eb2fc7aa86bb2c22f101d7df05 /qutebrowser/browser/commands.py
parentf2881c7e30be12ac5cceba96003b0482b24ed692 (diff)
downloadqutebrowser-5e5c778b4a1418bc4f06cf78885b8a895f5cf720.tar.gz
qutebrowser-5e5c778b4a1418bc4f06cf78885b8a895f5cf720.zip
Always close tabs when given or taken
Add an optional boolean argument to `tabbed_browser.close_tab()` called `transfer` which indicates whether the tab is closing as a result of being given to another window (`tab-give`) or taken by another window (`tab-take`). If so, the tab will always close, even if it is the last tab in the window and `tabs.last_close` is not set to 'close'.
Diffstat (limited to 'qutebrowser/browser/commands.py')
-rw-r--r--qutebrowser/browser/commands.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py
index f3438aaa8..5937e7604 100644
--- a/qutebrowser/browser/commands.py
+++ b/qutebrowser/browser/commands.py
@@ -451,7 +451,7 @@ class CommandDispatcher:
self._open(tab.url(), tab=True)
if not keep:
- tabbed_browser.close_tab(tab, add_undo=False)
+ tabbed_browser.close_tab(tab, add_undo=False, transfer=True)
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('win_id', completion=miscmodels.window)
@@ -500,7 +500,8 @@ class CommandDispatcher:
tabbed_browser.tabopen(self._current_url())
if not keep:
self._tabbed_browser.close_tab(self._current_widget(),
- add_undo=False)
+ add_undo=False,
+ transfer=True)
def _back_forward(self, tab, bg, window, count, forward, index=None):
"""Helper function for :back/:forward."""