debugger: More focus tweaks (#31232)
- Make remembering focus work with `ActivatePaneDown` as well - Tone down the console's focus-in behavior so clicking doesn't misbehave Release Notes: - N/A
This commit is contained in:
parent
26318b5b6a
commit
c4677c21a9
4 changed files with 24 additions and 25 deletions
|
@ -68,12 +68,13 @@ pub struct DebugPanel {
|
|||
pub(crate) thread_picker_menu_handle: PopoverMenuHandle<ContextMenu>,
|
||||
pub(crate) session_picker_menu_handle: PopoverMenuHandle<ContextMenu>,
|
||||
fs: Arc<dyn Fs>,
|
||||
_subscriptions: [Subscription; 1],
|
||||
}
|
||||
|
||||
impl DebugPanel {
|
||||
pub fn new(
|
||||
workspace: &Workspace,
|
||||
_window: &mut Window,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Workspace>,
|
||||
) -> Entity<Self> {
|
||||
cx.new(|cx| {
|
||||
|
@ -82,6 +83,14 @@ impl DebugPanel {
|
|||
let thread_picker_menu_handle = PopoverMenuHandle::default();
|
||||
let session_picker_menu_handle = PopoverMenuHandle::default();
|
||||
|
||||
let focus_subscription = cx.on_focus(
|
||||
&focus_handle,
|
||||
window,
|
||||
|this: &mut DebugPanel, window, cx| {
|
||||
this.focus_active_item(window, cx);
|
||||
},
|
||||
);
|
||||
|
||||
Self {
|
||||
size: px(300.),
|
||||
sessions: vec![],
|
||||
|
@ -93,6 +102,7 @@ impl DebugPanel {
|
|||
fs: workspace.app_state().fs.clone(),
|
||||
thread_picker_menu_handle,
|
||||
session_picker_menu_handle,
|
||||
_subscriptions: [focus_subscription],
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -101,15 +111,12 @@ impl DebugPanel {
|
|||
let Some(session) = self.active_session.clone() else {
|
||||
return;
|
||||
};
|
||||
let Some(active_pane) = session
|
||||
let active_pane = session
|
||||
.read(cx)
|
||||
.running_state()
|
||||
.read(cx)
|
||||
.active_pane()
|
||||
.cloned()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
.clone();
|
||||
active_pane.update(cx, |pane, cx| {
|
||||
pane.focus_active_item(window, cx);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue