git_ui: Dismiss pickers only on active window (#41320)

Small QOL improvement for branch picker to only dismiss when focus lost
in active window.
This can benefit those who need to switch windows mid branch creation to
fetch correct jira ticket number or etc.

Added `window.is_active_window()` guard in `picker.rs` -> `cancel` event

Release Notes:
- (Let's Git Together) Fixed a behavior where pickers would
automatically close upon the window becoming inactive.
This commit is contained in:
Ben Heimberg
2025-11-18 21:57:30 -05:00
committed by GitHub
parent 1e2f15a3d7
commit 24c1617e74
+4 -2
View File
@@ -607,7 +607,7 @@ impl<D: PickerDelegate> Picker<D> {
self.update_matches(query, window, cx);
}
editor::EditorEvent::Blurred => {
if self.is_modal {
if self.is_modal && window.is_window_active() {
self.cancel(&menu::Cancel, window, cx);
}
}
@@ -619,7 +619,9 @@ impl<D: PickerDelegate> Picker<D> {
let Head::Empty(_) = &self.head else {
panic!("unexpected call");
};
self.cancel(&menu::Cancel, window, cx);
if window.is_window_active() {
self.cancel(&menu::Cancel, window, cx);
}
}
pub fn refresh_placeholder(&mut self, window: &mut Window, cx: &mut App) {