Re-focus diagnostics editor when transitioning from an empty to a populated state

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo 2022-01-06 08:35:31 -07:00
parent 1875a0e349
commit 571d0386e2

View file

@ -389,8 +389,14 @@ impl ProjectDiagnosticsEditor {
self.path_states.remove(path_ix); self.path_states.remove(path_ix);
} }
if self.editor.is_focused(cx) && self.path_states.is_empty() { if self.path_states.is_empty() {
cx.focus_self(); if self.editor.is_focused(cx) {
cx.focus_self();
}
} else {
if cx.handle().is_focused(cx) {
cx.focus(&self.editor);
}
} }
cx.notify(); cx.notify();
} }