Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix panic during terminal tab drag and drop

Kirill Bulatovc499e1ed3842
diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs
index c19d0bfc6cb..c0f8e6209b2 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::<DraggedTab>() {
- 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::<TerminalView>().is_some() {
return ControlFlow::Continue(());
} else if let Some(project_path) = item.project_path(cx) {