Skip to content

fix(#190): keep add order for windows in a leaf before its first draw - #191

Merged
octalide merged 2 commits into
devfrom
fix/190
Oct 1, 2026
Merged

octalide merged 2 commits into
devfrom
fix/190

Conversation

@octalide

@octalide octalide commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #190

dock.add now docks through insert at an index past the last tab, so the window takes one more than the leaf's highest rank (the others are renumbered 0..n-1 as insert already does) and is selected. The draw-time sort before() breaks equal ranks with ahead(), by id, the same tie-break insert uses, so the order never follows the state store's walk. add's signature is unchanged.

Decided beyond the issue: re-adding a window already placed in the leaf's bar now moves its tab to the end, since it goes through insert's tabs.move. Before, its rank changed but the bar kept the tab where it was, which contradicted add's "as its last tab".

Test: space__keeps_tabs_in_the_order_they_were_added adds C, A, B to one leaf before its first draw and checks the tab order and front, then re-adds C after the draw. space__keyboard_crosses_docked_tabs_in_focus_order assumed the old walk order (C's tab before B's though B was added first). It now steps left from C to B.

Ran locally: mach test . --filter blit.dock, plus the gallery and panel demo tests. Both pass and the gallery golden is unchanged.

add docks through insert at an index past the last tab, so a window takes
one more than the leaf's highest rank and an already placed tab moves to
the end of its bar. the draw-time sort breaks equal ranks by id, as insert's
does, so the order no longer follows the state store's walk.
@octalide
octalide marked this pull request as ready for review October 1, 2026 16:40
@octalide
octalide merged commit 15bdb25 into dev Oct 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: windows added to a leaf before its first draw take no stable order

1 participant