+10
-4
@@ -599,6 +599,9 @@ impl App {
|
||||
let Some((ws_idx, pane_id)) = self.parse_pane_id(¶ms.pane_id) else {
|
||||
return pane_not_found(id, ¶ms.pane_id);
|
||||
};
|
||||
let Some(public_pane_id) = self.public_pane_id(ws_idx, pane_id) else {
|
||||
return pane_not_found(id, ¶ms.pane_id);
|
||||
};
|
||||
let Some((pane, workspace_id)) = self.lookup_runtime(ws_idx, pane_id) else {
|
||||
return pane_not_found(id, ¶ms.pane_id);
|
||||
};
|
||||
@@ -630,7 +633,7 @@ impl App {
|
||||
id,
|
||||
ResponseResult::PaneRead {
|
||||
read: PaneReadResult {
|
||||
pane_id: params.pane_id,
|
||||
pane_id: public_pane_id,
|
||||
workspace_id,
|
||||
tab_id: self.public_tab_id(ws_idx, tab_idx).unwrap(),
|
||||
source: params.source,
|
||||
@@ -887,6 +890,10 @@ impl App {
|
||||
let Some((ws_idx, pane_id)) = self.parse_pane_id(&target.pane_id) else {
|
||||
return pane_not_found(id, &target.pane_id);
|
||||
};
|
||||
let Some(public_pane_id) = self.public_pane_id(ws_idx, pane_id) else {
|
||||
return pane_not_found(id, &target.pane_id);
|
||||
};
|
||||
let workspace_id = self.public_workspace_id(ws_idx);
|
||||
if self.state.close_pane_would_close_workspace(ws_idx, pane_id)
|
||||
&& self.state.confirm_implicit_worktree_group_close(ws_idx)
|
||||
{
|
||||
@@ -896,7 +903,6 @@ impl App {
|
||||
"closing this pane would close a worktree group",
|
||||
);
|
||||
}
|
||||
let workspace_id = self.state.workspaces[ws_idx].id.clone();
|
||||
let terminal_id = self.state.terminal_id_for_pane(ws_idx, pane_id);
|
||||
let should_close_workspace = {
|
||||
let Some(ws) = self.state.workspaces.get_mut(ws_idx) else {
|
||||
@@ -911,7 +917,7 @@ impl App {
|
||||
self.emit_event(EventEnvelope {
|
||||
event: EventKind::PaneClosed,
|
||||
data: EventData::PaneClosed {
|
||||
pane_id: target.pane_id.clone(),
|
||||
pane_id: public_pane_id,
|
||||
workspace_id: workspace_id.clone(),
|
||||
},
|
||||
});
|
||||
@@ -926,7 +932,7 @@ impl App {
|
||||
self.emit_event(EventEnvelope {
|
||||
event: EventKind::PaneClosed,
|
||||
data: EventData::PaneClosed {
|
||||
pane_id: target.pane_id,
|
||||
pane_id: public_pane_id,
|
||||
workspace_id,
|
||||
},
|
||||
});
|
||||
|
||||
+13
-5
@@ -98,9 +98,13 @@ impl App {
|
||||
);
|
||||
if let Some(label) = label {
|
||||
let workspace_id = self.state.workspaces[ws_idx].id.clone();
|
||||
let tab_id = self
|
||||
.public_tab_id(ws_idx, tab_idx)
|
||||
.unwrap_or_else(|| format!("{}:{}", workspace_id, tab_idx + 1));
|
||||
let tab_id = self.public_tab_id(ws_idx, tab_idx).unwrap_or_else(|| {
|
||||
format!(
|
||||
"{}:t{}",
|
||||
workspace_id,
|
||||
crate::workspace::encode_public_number(tab_idx + 1)
|
||||
)
|
||||
});
|
||||
if let Some(tab) = self
|
||||
.state
|
||||
.workspaces
|
||||
@@ -186,6 +190,10 @@ impl App {
|
||||
let Some((ws_idx, tab_idx)) = self.parse_tab_id(&target.tab_id) else {
|
||||
return tab_not_found(id, &target.tab_id);
|
||||
};
|
||||
let Some(tab_id) = self.public_tab_id(ws_idx, tab_idx) else {
|
||||
return tab_not_found(id, &target.tab_id);
|
||||
};
|
||||
let workspace_id = self.public_workspace_id(ws_idx);
|
||||
let terminal_ids = self.state.terminal_ids_for_tab(ws_idx, tab_idx);
|
||||
let Some(ws) = self.state.workspaces.get_mut(ws_idx) else {
|
||||
return tab_not_found(id, &target.tab_id);
|
||||
@@ -210,8 +218,8 @@ impl App {
|
||||
self.emit_event(EventEnvelope {
|
||||
event: EventKind::TabClosed,
|
||||
data: EventData::TabClosed {
|
||||
tab_id: target.tab_id,
|
||||
workspace_id: self.public_workspace_id(ws_idx),
|
||||
tab_id,
|
||||
workspace_id,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -146,14 +146,13 @@ impl App {
|
||||
if self.state.workspaces.get(index).is_none() {
|
||||
return workspace_not_found(id, &target.workspace_id);
|
||||
}
|
||||
let workspace_id = self.public_workspace_id(index);
|
||||
self.state.selected = index;
|
||||
self.state.close_selected_workspace();
|
||||
self.shutdown_detached_terminal_runtimes();
|
||||
self.emit_event(EventEnvelope {
|
||||
event: EventKind::WorkspaceClosed,
|
||||
data: EventData::WorkspaceClosed {
|
||||
workspace_id: target.workspace_id,
|
||||
},
|
||||
data: EventData::WorkspaceClosed { workspace_id },
|
||||
});
|
||||
|
||||
encode_success(id, ResponseResult::Ok {})
|
||||
|
||||
Reference in New Issue
Block a user