Synchronize modal commit editor with panel editor (#26068)

Release Notes:

- Git Beta: Synchronized selections between the modal editor and the
panel editor
- Git Beta: Allow opening the commit modal even if we're unable to
commit.
This commit is contained in:
Mikayla Maki 2025-03-04 13:58:26 -08:00 committed by GitHub
parent 0a2d938ac5
commit ebc5c213a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 83 additions and 30 deletions

View file

@ -90,6 +90,21 @@ impl<'a, T: 'static> Context<'a, T> {
})
}
/// Subscribe to an event type from ourself
pub fn subscribe_self<Evt>(
&mut self,
mut on_event: impl FnMut(&mut T, &Evt, &mut Context<'_, T>) + 'static,
) -> Subscription
where
T: 'static + EventEmitter<Evt>,
Evt: 'static,
{
let this = self.entity();
self.app.subscribe(&this, move |this, evt, cx| {
this.update(cx, |this, cx| on_event(this, evt, cx))
})
}
/// Register a callback to be invoked when GPUI releases this entity.
pub fn on_release(&self, on_release: impl FnOnce(&mut T, &mut App) + 'static) -> Subscription
where