summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormohite-abhi <b518004@iiit-bh.ac.in>2022-01-23 19:06:47 +0530
committermohite-abhi <b518004@iiit-bh.ac.in>2022-01-23 19:14:47 +0530
commit57155e329ada002245ab3fac45d906f6707c14cf (patch)
tree40b2958e9f811247684215a2a2409900b33696b0
parent945e33857330a5894810d93036bf71450ee14aec (diff)
downloadqutebrowser-57155e329ada002245ab3fac45d906f6707c14cf.tar.gz
qutebrowser-57155e329ada002245ab3fac45d906f6707c14cf.zip
Fixes qutebrowser/qutebrowser#6967 by adding win id param in _tabs & using it in delete_tabs
As delete_tab was assuming that completion column contains window ID, it was showing exception in case of tab-focus, as it doesn't have the window ID in completion column. So instead a new parameter named current_win_id is used in _tabs which is also passed in all uses of the function.
-rw-r--r--qutebrowser/completion/models/miscmodels.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py
index d8ebafb29..34948a452 100644
--- a/qutebrowser/completion/models/miscmodels.py
+++ b/qutebrowser/completion/models/miscmodels.py
@@ -103,17 +103,21 @@ 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, current_win_id):
"""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.
+ current_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('/')
+
+ win_id = current_win_id
+ tab_index = data[0].split('/')[-1] # data[0] can be 'tabInd' or 'winID/tabInd'
+
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=int(win_id))
tabbed_browser.on_tab_close_requested(int(tab_index) - 1)
@@ -177,13 +181,13 @@ 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, current_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, current_win_id=info.win_id)
special = [
("last", "Focus the last-focused tab"),