diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-04 15:31:14 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-04 16:51:10 +0300 |
| commit | 15cab964f3494b77159caaea289e17e1596e0720 (patch) | |
| tree | d9614056c26b0d148771a464fc2eb0f0cabc60a2 /src/app/api/plugins/panes.rs | |
| parent | b78a8a5c565e66e7e5ba9a06d9cb7f3a771fc4b0 (diff) | |
feat: emit layout update events for runtime layout changes
Diffstat (limited to 'src/app/api/plugins/panes.rs')
| -rw-r--r-- | src/app/api/plugins/panes.rs | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/app/api/plugins/panes.rs b/src/app/api/plugins/panes.rs index 5a935a8c..b2988998 100644 --- a/src/app/api/plugins/panes.rs +++ b/src/app/api/plugins/panes.rs @@ -27,7 +27,19 @@ impl App { Ok(result) => result, Err(err) => return encode_error(id, "plugin_pane_open_failed", err.to_string()), }; - self.finish_plugin_pane_open(id, ws_idx, None, new_pane, plugin.plugin_id.clone(), pane) + let layout_tab_idx = self + .overlay_panes + .get(&new_pane.pane_id) + .map(|overlay| overlay.tab_idx); + self.finish_plugin_pane_open( + id, + ws_idx, + None, + layout_tab_idx, + new_pane, + plugin.plugin_id.clone(), + pane, + ) } pub(super) fn open_plugin_split_pane( @@ -110,7 +122,15 @@ impl App { tab.zoomed = true; } } - self.finish_plugin_pane_open(id, ws_idx, None, new_pane, plugin.plugin_id.clone(), pane) + self.finish_plugin_pane_open( + id, + ws_idx, + None, + Some(tab_idx), + new_pane, + plugin.plugin_id.clone(), + pane, + ) } pub(super) fn open_plugin_tab( @@ -167,6 +187,7 @@ impl App { id, ws_idx, Some(tab_idx), + Some(tab_idx), new_pane, plugin.plugin_id.clone(), pane, @@ -212,6 +233,7 @@ impl App { id: String, ws_idx: usize, created_tab_idx: Option<usize>, + layout_tab_idx: Option<usize>, new_pane: crate::workspace::NewPane, plugin_id: String, pane_manifest: PluginManifestPane, @@ -248,6 +270,9 @@ impl App { event: crate::api::schema::EventKind::PaneCreated, data: crate::api::schema::EventData::PaneCreated { pane: pane.clone() }, }); + if let Some(tab_idx) = layout_tab_idx { + self.emit_layout_updated_event(ws_idx, tab_idx); + } encode_success( id, ResponseResult::PluginPaneOpened { |
