Compare commits

...

3 Commits

Author SHA1 Message Date
Bennet Bo Fenner
6f71c33529 Check model picker as well 2025-03-03 15:55:14 +01:00
Bennet Bo Fenner
b9c6f8caa8 Also check if inline context picker is deployed 2025-03-03 13:51:29 +01:00
Bennet Bo Fenner
207e57910b Allow dismissing file/directory picker with escape 2025-03-03 13:46:47 +01:00
4 changed files with 17 additions and 4 deletions

View File

@@ -231,6 +231,11 @@ impl AssistantPanel {
_window: &mut Window,
cx: &mut Context<Self>,
) {
// If the context picker is deployed, we do not want to interfere with the cancel event
if self.message_editor.read(cx).is_any_picker_deployed(cx) {
cx.propagate();
return;
}
self.thread
.update(cx, |thread, cx| thread.cancel_last_completion(cx));
}

View File

@@ -140,6 +140,12 @@ impl MessageEditor {
self.send_to_model(RequestKind::Chat, window, cx);
}
pub fn is_any_picker_deployed(&self, cx: &App) -> bool {
self.context_picker_menu_handle.is_deployed()
|| self.inline_context_picker_menu_handle.is_deployed()
|| self.model_selector.read(cx).selector.read(cx).is_deployed()
}
fn is_editor_empty(&self, cx: &App) -> bool {
self.editor.read(cx).text(cx).is_empty()
}
@@ -252,9 +258,7 @@ impl MessageEditor {
}
fn move_up(&mut self, _: &MoveUp, window: &mut Window, cx: &mut Context<Self>) {
if self.context_picker_menu_handle.is_deployed()
|| self.inline_context_picker_menu_handle.is_deployed()
{
if self.is_any_picker_deployed(cx) {
cx.propagate();
} else {
self.context_strip.focus_handle(cx).focus(window);

View File

@@ -755,7 +755,7 @@ pub trait InteractiveElement: Sized {
}
/// Capture the given action, before normal action dispatch can fire
/// The fluent API equivalent to [`Interactivity::on_scroll_wheel`]
/// The fluent API equivalent to [`Interactivity::capture_action`]
///
/// See [`Context::listener`](crate::Context::listener) to get access to a view's state from this callback.
fn capture_action<A: Action>(

View File

@@ -73,6 +73,10 @@ impl LanguageModelSelector {
}
}
pub fn is_deployed(&self) -> bool {
self.popover_menu_handle.is_deployed()
}
pub fn toggle_model_selector(
&mut self,
_: &ToggleModelSelector,