Maintain selection on file/dir deletion in project panel (#20577)

Closes #20444

- Focus on next file/dir on deletion.
- Focus on prev file/dir in case where it's last item in worktree.
- Tested when multiple files/dirs are being deleted.

Release Notes:

- Maintain selection on file/dir deletion in project panel.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
tims 2024-11-22 16:29:04 +05:30 committed by GitHub
parent 933c11a9b2
commit 114c462143
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 813 additions and 21 deletions

View file

@ -48,7 +48,7 @@ use ui::{v_flex, ContextMenu};
use util::{debug_panic, maybe, truncate_and_remove_front, ResultExt};
/// A selected entry in e.g. project panel.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SelectedEntry {
pub worktree_id: WorktreeId,
pub entry_id: ProjectEntryId,