Skip to content
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

Tree::is_empty has inconsistent behavior #242

Open
jarruda opened this issue Jun 2, 2024 · 0 comments
Open

Tree::is_empty has inconsistent behavior #242

jarruda opened this issue Jun 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jarruda
Copy link

jarruda commented Jun 2, 2024

Describe the bug
I believe that is_empty is the intended method to know if there are any tabs present. However, it has two different behaviors that make it unsuitable for this purpose: it returns false after initialization with an empty tab set, but it returns true after adding tabs and closing them all.

To Reproduce
Steps to reproduce the behavior:

  1. Initialize DockState with no tabs, it returns false because there is a single, Empty node:
DockState::new(vec![]) // calls ->

let root = Node::leaf_with(tabs);
Self {
    nodes: vec![root],
    focused_node: None,
}
  1. Add a tab and close it using the UI. When the last tab is closed in the Dock, is_empty will return true because there are now no nodes in the Tree.

Expected behavior
is_empty returns true when there are no viewable tabs in the UI (or some other method fulfills this need.)

@jarruda jarruda added the bug Something isn't working label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant