This commit is contained in:
Ben Kunkle 2026-06-16 12:03:29 -05:00
parent 0a8a0d3c37
commit 3d83ccf179
5 changed files with 24 additions and 45 deletions

View file

@ -5363,37 +5363,28 @@ impl AgentPanel {
)
.into_any_element()
} else {
let focus_active_thread = {
let conversation_view = conversation_view.downgrade();
move |window: &mut Window, cx: &mut App| {
if let Some(conversation_view) = conversation_view.upgrade()
&& let Some(thread) =
conversation_view.read(cx).active_thread().cloned()
{
thread
.read(cx)
.activation_focus_handle(cx)
.focus(window, cx);
}
}
};
let editable_title = div()
.flex_1()
.on_action({
let conversation_view = conversation_view.downgrade();
move |_: &menu::Confirm, window, cx| {
if let Some(conversation_view) = conversation_view.upgrade() {
let thread =
conversation_view.read(cx).active_thread().cloned();
if let Some(thread) = thread {
thread
.read(cx)
.activation_focus_handle(cx)
.focus(window, cx);
}
}
}
let focus_active_thread = focus_active_thread.clone();
move |_: &menu::Confirm, window, cx| focus_active_thread(window, cx)
})
.on_action({
let conversation_view = conversation_view.downgrade();
move |_: &editor::actions::Cancel, window, cx| {
if let Some(conversation_view) = conversation_view.upgrade() {
let thread =
conversation_view.read(cx).active_thread().cloned();
if let Some(thread) = thread {
thread
.read(cx)
.activation_focus_handle(cx)
.focus(window, cx);
}
}
}
.on_action(move |_: &editor::actions::Cancel, window, cx| {
focus_active_thread(window, cx)
})
.child(title_editor);
@ -7121,7 +7112,9 @@ mod tests {
let thread_view = panel.read_with(cx, |panel, cx| panel.active_thread_view(cx).unwrap());
thread_view.update(cx, |thread_view, cx| {
thread_view.expanded_tool_calls.insert(tool_call_id);
thread_view.entry_view_state.update(cx, |state, _cx| {
state.expand_tool_call(tool_call_id);
});
cx.notify();
});

View file

@ -1536,10 +1536,6 @@ impl Focusable for DebugPanel {
}
impl Panel for DebugPanel {
fn activation_focus_handle(&self, cx: &App) -> FocusHandle {
self.focus_handle(cx)
}
fn persistent_name() -> &'static str {
"DebugPanel"
}

View file

@ -7517,10 +7517,6 @@ impl EventEmitter<Event> for ProjectPanel {}
impl EventEmitter<PanelEvent> for ProjectPanel {}
impl Panel for ProjectPanel {
fn activation_focus_handle(&self, cx: &App) -> FocusHandle {
self.focus_handle(cx)
}
fn position(&self, _: &Window, cx: &App) -> DockPosition {
match ProjectPanelSettings::get_global(cx).dock {
DockSide::Left => DockPosition::Left,

View file

@ -1526,10 +1526,6 @@ impl Focusable for TerminalPanel {
}
impl Panel for TerminalPanel {
fn activation_focus_handle(&self, cx: &App) -> FocusHandle {
self.focus_handle(cx)
}
fn position(&self, _window: &Window, cx: &App) -> DockPosition {
TerminalSettings::get_global(cx).dock.into()
}

View file

@ -36,7 +36,9 @@ pub use proto::PanelId;
pub trait Panel: Focusable + EventEmitter<PanelEvent> + Render + Sized {
fn persistent_name() -> &'static str;
fn panel_key() -> &'static str;
fn activation_focus_handle(&self, cx: &App) -> FocusHandle;
fn activation_focus_handle(&self, cx: &App) -> FocusHandle {
self.focus_handle(cx)
}
fn position(&self, window: &Window, cx: &App) -> DockPosition;
fn position_is_valid(&self, position: DockPosition) -> bool;
fn set_position(&mut self, position: DockPosition, window: &mut Window, cx: &mut Context<Self>);
@ -1479,10 +1481,6 @@ pub mod test {
}
impl Panel for TestPanel {
fn activation_focus_handle(&self, cx: &App) -> FocusHandle {
self.focus_handle(cx)
}
fn persistent_name() -> &'static str {
"TestPanel"
}