assistant2: Use cmd-n
to create a new prompt editor when already in a prompt editor (#25935)
This flips the keybindings that are used to create a new thread/prompt editor (only when you're already in a prompt editor) Release Notes: - N/A
This commit is contained in:
parent
f31749c81b
commit
909de2ca6f
3 changed files with 28 additions and 2 deletions
|
@ -612,6 +612,14 @@
|
||||||
"ctrl-alt-e": "assistant2::RemoveAllContext"
|
"ctrl-alt-e": "assistant2::RemoveAllContext"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"context": "AssistantPanel2 && prompt_editor",
|
||||||
|
"use_key_equivalents": true,
|
||||||
|
"bindings": {
|
||||||
|
"cmd-n": "assistant2::NewPromptEditor",
|
||||||
|
"cmd-alt-t": "assistant2::NewThread"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"context": "MessageEditor > Editor",
|
"context": "MessageEditor > Editor",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
|
|
|
@ -256,6 +256,14 @@
|
||||||
"cmd-alt-e": "assistant2::RemoveAllContext"
|
"cmd-alt-e": "assistant2::RemoveAllContext"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"context": "AssistantPanel2 && prompt_editor",
|
||||||
|
"use_key_equivalents": true,
|
||||||
|
"bindings": {
|
||||||
|
"cmd-n": "assistant2::NewPromptEditor",
|
||||||
|
"cmd-alt-t": "assistant2::NewThread"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"context": "MessageEditor > Editor",
|
"context": "MessageEditor > Editor",
|
||||||
"use_key_equivalents": true,
|
"use_key_equivalents": true,
|
||||||
|
|
|
@ -15,7 +15,8 @@ use editor::Editor;
|
||||||
use fs::Fs;
|
use fs::Fs;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
prelude::*, Action, AnyElement, App, AsyncWindowContext, Corner, Entity, EventEmitter,
|
prelude::*, Action, AnyElement, App, AsyncWindowContext, Corner, Entity, EventEmitter,
|
||||||
FocusHandle, Focusable, FontWeight, Pixels, Subscription, Task, UpdateGlobal, WeakEntity,
|
FocusHandle, Focusable, FontWeight, KeyContext, Pixels, Subscription, Task, UpdateGlobal,
|
||||||
|
WeakEntity,
|
||||||
};
|
};
|
||||||
use language::LanguageRegistry;
|
use language::LanguageRegistry;
|
||||||
use language_model::{LanguageModelProviderTosView, LanguageModelRegistry};
|
use language_model::{LanguageModelProviderTosView, LanguageModelRegistry};
|
||||||
|
@ -993,12 +994,21 @@ impl AssistantPanel {
|
||||||
)
|
)
|
||||||
.into_any()
|
.into_any()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn key_context(&self) -> KeyContext {
|
||||||
|
let mut key_context = KeyContext::new_with_defaults();
|
||||||
|
key_context.add("AssistantPanel2");
|
||||||
|
if matches!(self.active_view, ActiveView::PromptEditor) {
|
||||||
|
key_context.add("prompt_editor");
|
||||||
|
}
|
||||||
|
key_context
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for AssistantPanel {
|
impl Render for AssistantPanel {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
v_flex()
|
v_flex()
|
||||||
.key_context("AssistantPanel2")
|
.key_context(self.key_context())
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.size_full()
|
.size_full()
|
||||||
.on_action(cx.listener(Self::cancel))
|
.on_action(cx.listener(Self::cancel))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue