Add action to move active item into the dock

Co-Authored-By: Kay Simmons <kay@zed.dev>
This commit is contained in:
Julia 2022-10-21 15:45:05 -04:00 committed by K Simmons
parent b9f9819637
commit ba35536664
5 changed files with 56 additions and 16 deletions

View file

@ -575,6 +575,10 @@ impl Pane {
}
}
pub fn items_len(&self) -> usize {
self.items.len()
}
pub fn items(&self) -> impl Iterator<Item = &Box<dyn ItemHandle>> {
self.items.iter()
}
@ -943,11 +947,11 @@ impl Pane {
}
}
fn move_item(
pub fn move_item(
workspace: &mut Workspace,
from: ViewHandle<Pane>,
to: ViewHandle<Pane>,
item_to_move: usize,
item_id_to_move: usize,
destination_index: usize,
cx: &mut ViewContext<Workspace>,
) {
@ -955,7 +959,7 @@ impl Pane {
.read(cx)
.items()
.enumerate()
.find(|(_, item_handle)| item_handle.id() == item_to_move);
.find(|(_, item_handle)| item_handle.id() == item_id_to_move);
if item_to_move.is_none() {
log::warn!("Tried to move item handle which was not in `from` pane. Maybe tab was closed during drop");
@ -1321,7 +1325,7 @@ impl Pane {
tab.constrained().with_height(tab_style.height).boxed()
}
fn handle_dropped_item(pane: &WeakViewHandle<Pane>, index: usize, cx: &mut EventContext) {
pub fn handle_dropped_item(pane: &WeakViewHandle<Pane>, index: usize, cx: &mut EventContext) {
if let Some((_, dragged_item)) = cx
.global::<DragAndDrop<Workspace>>()
.currently_dragged::<DraggedItem>(cx.window_id)