From c6bcb496a2cbeb9dec06393e2566aa59e3a90021 Mon Sep 17 00:00:00 2001 From: toofar Date: Wed, 27 Dec 2023 09:27:33 +1300 Subject: 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? --- qutebrowser/mainwindow/treetabbedbrowser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-54-g00ecf