-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace binary tree to allow more that two splits per node #212
base: release-0.15
Are you sure you want to change the base?
Replace binary tree to allow more that two splits per node #212
Conversation
-The DockState can use the method on the tree and does not need to reach into the fields of a tree
- These operations are only possible on a binary tree and will have to have access to the tree going forwards
- Nodes are still stored in a Vec but the position and order of the nodes no longer follows that of a binary tree. A node still only allows for a left and right node. So in practice it is still technically a binary tree. The implementation however no longer relies on this fact and should make further changes easer. - A node can no longer be split on its own.
@Adanos020 In this first step i wanted to only remove any dependencies the code might have on the binary tree. The Tree still behaves like a binary tree but the layout of the nodes in the Vec is free. This should make it easier to implement the actual feature later. |
* Fix crash after calling `DockState::remove_tab`. (Adanos020#208) * Remove surface after removing the last remaining tab, if the surface isn't `Main`. * Add explicit panic in `Tree::remove_leaf` if the `Tree` is empty. * Bump patch version, update changelog. * Include instructions on how to run examples in Readme. (Adanos020#209) * Fix keyboard focus not working inside `DockArea`s * Add visual indicators when tab buttons are focused * Allow current tab to be switched using the keyboard * Remove extra focusable areas I removed focus from two widgets that are not supposed to be focusable. Also, I added highlighting to the separators when they are focused because apparently I can't remove the ability to focus them without breaking the ability to drag the separators. * Separators can now be moved with the arrow keys * Add highlighting to active tabs that are keyboard focused * Update changelog * Add tab styles for keyboard-focused tabs * Don't move separators unless Ctrl or Shift is down This is so that using the arrow keys to change the keyboard focus will still work normally. * Clippy --------- Co-authored-by: Adam Gąsior <adanos020@gmail.com>
@LennysLounge Hey, thanks for giving it a stab. I noticed that sometimes when you drag a tab out of a window surface and dock it somewhere else, the application panics on window_surface.rs, line 77. Turns out that it in the statement above, Since we're not operating on a binary tree anymore, maybe we should phase out |
Yes, That Bug you mentioned bother me though. I encountered a similar bug at the same place before and thought i had fixed it. Apparently not. And i cant replicate it from your description either. If i remove |
I think replacing the underlying data structure is already a very radical change, so going all in and removing As for the bug, I found very a consistent reproduction:
|
* Fix crash after calling `DockState::remove_tab`. (Adanos020#208) * Remove surface after removing the last remaining tab, if the surface isn't `Main`. * Add explicit panic in `Tree::remove_leaf` if the `Tree` is empty. * Bump patch version, update changelog. * Include instructions on how to run examples in Readme. (Adanos020#209) * Fix keyboard focus not working inside `DockArea`s * Add visual indicators when tab buttons are focused * Allow current tab to be switched using the keyboard * Remove extra focusable areas I removed focus from two widgets that are not supposed to be focusable. Also, I added highlighting to the separators when they are focused because apparently I can't remove the ability to focus them without breaking the ability to drag the separators. * Separators can now be moved with the arrow keys * Add highlighting to active tabs that are keyboard focused * Update changelog * Add tab styles for keyboard-focused tabs * Don't move separators unless Ctrl or Shift is down This is so that using the arrow keys to change the keyboard focus will still work normally. * Clippy --------- Co-authored-by: Adam Gąsior <adanos020@gmail.com>
ed990ed
to
c2066c5
Compare
- When a node is removed this might cause a sibling of the node to be moved. If the sibling is focused this caused the focused node to point to an stale node.
Found the bug and fixed it. There was a special case when removing a node where a sibling node was moved. If that sibling node was focused, the focus was now on a stale node and could cause the panic. The focus is now correctly updated. |
I successfuly removed I briefly tried to replace the iterator with one that only iterates over valid nodes in breadth first order but hit a blocker with the mutable iterator. I dont really know how to continue with that problem. |
I see, I can take a look if there's a way to solve this. |
- Make the breadth first index iterator public
da38c5d
to
34f159a
Compare
- The exact behavior of these functions still need to be discussed.
8d7da82
to
5666cb1
Compare
5666cb1
to
6c29d1e
Compare
Related to #147
Replaces the internal binary tree with a tree that allows a arbitrary amount of splits per node.