acp thread view: Do not go into editing mode if unsupported (#36623)
Release Notes: - N/A
This commit is contained in:
parent
fa8bef1496
commit
02dabbb9fa
1 changed files with 13 additions and 5 deletions
|
@ -669,8 +669,14 @@ impl AcpThreadView {
|
||||||
) {
|
) {
|
||||||
match &event.view_event {
|
match &event.view_event {
|
||||||
ViewEvent::MessageEditorEvent(_editor, MessageEditorEvent::Focus) => {
|
ViewEvent::MessageEditorEvent(_editor, MessageEditorEvent::Focus) => {
|
||||||
self.editing_message = Some(event.entry_index);
|
if let Some(thread) = self.thread()
|
||||||
cx.notify();
|
&& let Some(AgentThreadEntry::UserMessage(user_message)) =
|
||||||
|
thread.read(cx).entries().get(event.entry_index)
|
||||||
|
&& user_message.id.is_some()
|
||||||
|
{
|
||||||
|
self.editing_message = Some(event.entry_index);
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ViewEvent::MessageEditorEvent(editor, MessageEditorEvent::Send) => {
|
ViewEvent::MessageEditorEvent(editor, MessageEditorEvent::Send) => {
|
||||||
self.regenerate(event.entry_index, editor, window, cx);
|
self.regenerate(event.entry_index, editor, window, cx);
|
||||||
|
@ -1116,16 +1122,18 @@ impl AcpThreadView {
|
||||||
.when(editing && !editor_focus, |this| this.border_dashed())
|
.when(editing && !editor_focus, |this| this.border_dashed())
|
||||||
.border_color(cx.theme().colors().border)
|
.border_color(cx.theme().colors().border)
|
||||||
.map(|this|{
|
.map(|this|{
|
||||||
if editor_focus {
|
if editing && editor_focus {
|
||||||
this.border_color(focus_border)
|
this.border_color(focus_border)
|
||||||
} else {
|
} else if message.id.is_some() {
|
||||||
this.hover(|s| s.border_color(focus_border.opacity(0.8)))
|
this.hover(|s| s.border_color(focus_border.opacity(0.8)))
|
||||||
|
} else {
|
||||||
|
this
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.text_xs()
|
.text_xs()
|
||||||
.child(editor.clone().into_any_element()),
|
.child(editor.clone().into_any_element()),
|
||||||
)
|
)
|
||||||
.when(editor_focus, |this|
|
.when(editing && editor_focus, |this|
|
||||||
this.child(
|
this.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.absolute()
|
.absolute()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue