From c499e1ed3842b0e635d0c9da47deaf7e59a01680 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 7 Jan 2024 02:32:15 +0200 Subject: [PATCH] Fix panic during terminal tab drag and drop --- crates/terminal_view/src/terminal_panel.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index c19d0bfc6c..c0f8e6209b 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -99,7 +99,12 @@ impl TerminalPanel { let workspace = workspace.weak_handle(); pane.set_custom_drop_handle(cx, move |pane, dropped_item, cx| { if let Some(tab) = dropped_item.downcast_ref::() { - if let Some(item) = tab.pane.read(cx).item_for_index(tab.ix) { + let item = if &tab.pane == cx.view() { + pane.item_for_index(tab.ix) + } else { + tab.pane.read(cx).item_for_index(tab.ix) + }; + if let Some(item) = item { if item.downcast::().is_some() { return ControlFlow::Continue(()); } else if let Some(project_path) = item.project_path(cx) {