diagnostics: Fix losing focus when activating from diagnostics view (#25517)
Closes #25509 Changes: - If active item is already diagnostics, don't try to focus it again. Instead of not focusing, should it just not activate instead? Something like: if !workspace .active_item(cx) .map(|item| item.item_id() == existing.item_id()) .unwrap_or(false) { workspace.activate_item(&existing, true, true, window, cx); } Release Notes: - N/A
This commit is contained in:
parent
f14d6670ba
commit
ed6bf7f161
1 changed files with 4 additions and 1 deletions
|
@ -311,7 +311,10 @@ impl ProjectDiagnosticsEditor {
|
||||||
cx: &mut Context<Workspace>,
|
cx: &mut Context<Workspace>,
|
||||||
) {
|
) {
|
||||||
if let Some(existing) = workspace.item_of_type::<ProjectDiagnosticsEditor>(cx) {
|
if let Some(existing) = workspace.item_of_type::<ProjectDiagnosticsEditor>(cx) {
|
||||||
workspace.activate_item(&existing, true, true, window, cx);
|
let is_active = workspace
|
||||||
|
.active_item(cx)
|
||||||
|
.is_some_and(|item| item.item_id() == existing.item_id());
|
||||||
|
workspace.activate_item(&existing, true, !is_active, window, cx);
|
||||||
} else {
|
} else {
|
||||||
let workspace_handle = cx.entity().downgrade();
|
let workspace_handle = cx.entity().downgrade();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue