agent_ui: Add check to prevent sending empty messages in MessageEditor (#36545)
Release Notes: - N/A
This commit is contained in:
parent
ceec258bf3
commit
d273aca1c1
2 changed files with 30 additions and 1 deletions
|
@ -66,7 +66,7 @@ pub struct MessageEditor {
|
|||
_parse_slash_command_task: Task<()>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum MessageEditorEvent {
|
||||
Send,
|
||||
Cancel,
|
||||
|
@ -728,6 +728,9 @@ impl MessageEditor {
|
|||
}
|
||||
|
||||
fn send(&mut self, _: &Chat, _: &mut Window, cx: &mut Context<Self>) {
|
||||
if self.is_empty(cx) {
|
||||
return;
|
||||
}
|
||||
cx.emit(MessageEditorEvent::Send)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue