diff options
author | toofar <toofar@spalge.com> | 2023-12-27 09:27:33 +1300 |
---|---|---|
committer | toofar <toofar@spalge.com> | 2024-01-06 21:02:43 +1300 |
commit | c6bcb496a2cbeb9dec06393e2566aa59e3a90021 (patch) | |
tree | 9d1e8eafd961d8789920541487794f131ac424fa | |
parent | c2bc549605a3c0bbb67187bbc197bc38f4a3085a (diff) | |
download | qutebrowser-c6bcb496a2cbeb9dec06393e2566aa59e3a90021.tar.gz qutebrowser-c6bcb496a2cbeb9dec06393e2566aa59e3a90021.zip |
Add explanatory comments in `_remove_tab()`
Hopefully it saves someone else from having to interpret it in the
future.
Also change the last line into an assert because is should be redundant.
This method seems more complex than it should be. Should, or is, some of
this functionality be available in the notree data structure?
-rw-r--r-- | qutebrowser/mainwindow/treetabbedbrowser.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/qutebrowser/mainwindow/treetabbedbrowser.py b/qutebrowser/mainwindow/treetabbedbrowser.py index b749b6969..eacc9f4c3 100644 --- a/qutebrowser/mainwindow/treetabbedbrowser.py +++ b/qutebrowser/mainwindow/treetabbedbrowser.py @@ -107,6 +107,9 @@ class TreeTabbedBrowser(TabbedBrowser): children = node.children if children: + # Promote first child, + # make that promoted node the parent of our other children + # give the promoted node our position in our siblings list. next_node = children[0] for n in children[1:]: @@ -117,7 +120,7 @@ class TreeTabbedBrowser(TabbedBrowser): siblings[node_idx] = next_node parent.children = tuple(siblings) - node.children = () + assert not node.children node.parent = None |