summaryrefslogtreecommitdiff
path: root/qutebrowser/completion/models/miscmodels.py
diff options
context:
space:
mode:
Diffstat (limited to 'qutebrowser/completion/models/miscmodels.py')
-rw-r--r--qutebrowser/completion/models/miscmodels.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py
index d8ebafb29..77072c720 100644
--- a/qutebrowser/completion/models/miscmodels.py
+++ b/qutebrowser/completion/models/miscmodels.py
@@ -103,17 +103,23 @@ def session(*, info=None):
return model
-def _tabs(*, win_id_filter=lambda _win_id: True, add_win_id=True):
+def _tabs(*, win_id_filter=lambda _win_id: True, add_win_id=True, cur_win_id=None):
"""Helper to get the completion model for tabs/other_tabs.
Args:
win_id_filter: A filter function for window IDs to include.
Should return True for all included windows.
add_win_id: Whether to add the window ID to the completion items.
+ cur_win_id: Window ID to be passed from info.win_id
"""
def delete_tab(data):
"""Close the selected tab."""
- win_id, tab_index = data[0].split('/')
+ if cur_win_id is None:
+ win_id, tab_index = data[0].split('/')
+ else:
+ win_id = cur_win_id
+ tab_index = data[0]
+
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=int(win_id))
tabbed_browser.on_tab_close_requested(int(tab_index) - 1)
@@ -177,13 +183,15 @@ def other_tabs(*, info):
Used for the tab-take command.
"""
- return _tabs(win_id_filter=lambda win_id: win_id != info.win_id)
+ return _tabs(
+ win_id_filter=lambda win_id: win_id != info.win_id,
+ cur_win_id=info.win_id)
def tab_focus(*, info):
"""A model to complete on open tabs in the current window."""
model = _tabs(win_id_filter=lambda win_id: win_id == info.win_id,
- add_win_id=False)
+ add_win_id=False, cur_win_id=info.win_id)
special = [
("last", "Focus the last-focused tab"),