workspace: Fix drag&dropping project panel entries into editor area (#12767)
Fixes #12733 Release Notes: - Fixed drag&dropping project panel entries into editor area & tab bar
This commit is contained in:
parent
07dbd2bce8
commit
5f5e6b8616
2 changed files with 40 additions and 33 deletions
|
@ -36,7 +36,7 @@ use util::{maybe, NumericPrefixWithSuffix, ResultExt, TryFutureExt};
|
|||
use workspace::{
|
||||
dock::{DockPosition, Panel, PanelEvent},
|
||||
notifications::{DetachAndPromptErr, NotifyTaskExt},
|
||||
OpenInTerminal, Workspace,
|
||||
DraggedSelection, OpenInTerminal, SelectedEntry, Workspace,
|
||||
};
|
||||
use worktree::CreatedEntry;
|
||||
|
||||
|
@ -65,26 +65,6 @@ pub struct ProjectPanel {
|
|||
pending_serialization: Task<Option<()>>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
struct SelectedEntry {
|
||||
worktree_id: WorktreeId,
|
||||
entry_id: ProjectEntryId,
|
||||
}
|
||||
|
||||
struct DraggedSelection {
|
||||
active_selection: SelectedEntry,
|
||||
marked_selections: Arc<BTreeSet<SelectedEntry>>,
|
||||
}
|
||||
|
||||
impl DraggedSelection {
|
||||
fn items<'a>(&'a self) -> Box<dyn Iterator<Item = &'a SelectedEntry> + 'a> {
|
||||
if self.marked_selections.contains(&self.active_selection) {
|
||||
Box::new(self.marked_selections.iter())
|
||||
} else {
|
||||
Box::new(std::iter::once(&self.active_selection))
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug)]
|
||||
struct EditState {
|
||||
worktree_id: WorktreeId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue