fix(screen): focus tab as well as pane when launching existing plugin (#2530)
* fix(screen): focus tab as well as pane when launching existing plugin * style(fmt): rustfmt
This commit is contained in:
parent
02ee810d82
commit
c65017c766
1 changed files with 17 additions and 5 deletions
|
|
@ -1472,16 +1472,28 @@ impl Screen {
|
||||||
client_id: ClientId,
|
client_id: ClientId,
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
// true => found and focused, false => not
|
// true => found and focused, false => not
|
||||||
|
let err_context = || format!("failed to focus_plugin_pane");
|
||||||
|
let mut tab_index_and_plugin_pane_id = None;
|
||||||
let all_tabs = self.get_tabs_mut();
|
let all_tabs = self.get_tabs_mut();
|
||||||
for tab in all_tabs.values_mut() {
|
for (tab_index, tab) in all_tabs.iter_mut() {
|
||||||
if let Some(plugin_pane_id) = tab.find_plugin(&run_plugin) {
|
if let Some(plugin_pane_id) = tab.find_plugin(&run_plugin) {
|
||||||
tab.focus_pane_with_id(plugin_pane_id, should_float, client_id)
|
tab_index_and_plugin_pane_id = Some((*tab_index, plugin_pane_id));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
match tab_index_and_plugin_pane_id {
|
||||||
|
Some((tab_index, plugin_pane_id)) => {
|
||||||
|
self.go_to_tab(tab_index + 1, client_id)?;
|
||||||
|
self.tabs
|
||||||
|
.get_mut(&tab_index)
|
||||||
|
.with_context(err_context)?
|
||||||
|
.focus_pane_with_id(plugin_pane_id, should_float, client_id)
|
||||||
.context("failed to focus plugin pane")?;
|
.context("failed to focus plugin pane")?;
|
||||||
return Ok(true);
|
Ok(true)
|
||||||
|
},
|
||||||
|
None => Ok(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn unblock_input(&self) -> Result<()> {
|
fn unblock_input(&self) -> Result<()> {
|
||||||
self.bus
|
self.bus
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue