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

Nested selection conflict detection #688

Closed
1 task
sxyazi opened this issue Feb 16, 2024 · 4 comments · Fixed by #689
Closed
1 task

Nested selection conflict detection #688

sxyazi opened this issue Feb 16, 2024 · 4 comments · Fixed by #689
Assignees
Labels
feature New feature request good first issue Good for newcomers

Comments

@sxyazi
Copy link
Owner

sxyazi commented Feb 16, 2024

If anyone is interested in this issue, please reply below!


Is your feature request related to a problem? Please describe

No response

Will you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

I'm trying to add support for cross-directory selection, which will allow users to select files from different directories at the same time and perform actions on them (copy, paste, etc.).

However, we must avoid situations of nested selection. For example, a user can select both /a/b, and /a/c, but cannot select /a, /a/b, nor /a/b/c, /a/b, as this would cause abnormalities in functions like copy, cut.

To achieve this, we need to modify the existing structure:

pub selected: BTreeSet<Url>,

to:

pub selected: Selected

and Selected providing two add() and remove() APIs:

pub struct Selected {
    inner: BTreeSet<Url>,
    // Other fields
}

impl Selected {
    pub fn add(&mut self, url: &Url) -> bool {}
    pub fn remove(&mut self, url: &Url) {}
}

add() and remove() will add the passed URL to the BTreeSet<Url> representing the selected items. If a conflict occurs, add() returns false; otherwise, it returns true. The pseudocode be like:

s1.add("/a") // true
s1.add("/a/b") // false (conflict)

s2.add("/a/b/c") // true
s2.add("/a/b") // false (conflict)
s2.add("/a/b/d") // true

Describe alternatives you've considered

No response

Additional context

No response

@sxyazi sxyazi added feature New feature request good first issue Good for newcomers labels Feb 16, 2024
@evpeople
Copy link
Contributor

Hi !
I am very interested in this issue and would be happy to handle it.

@sxyazi
Copy link
Owner Author

sxyazi commented Feb 17, 2024

Thanks! @evpeople

@og900aero
Copy link

I'm very interested too :)

Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants