Cancel inline assist editor on blur if it wasn't confirmed (#12684)

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2024-06-05 16:31:45 +02:00 committed by GitHub
parent 3587e9726b
commit 7a05db6d3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -697,9 +697,17 @@ impl InlineAssistEditor {
event: &EditorEvent, event: &EditorEvent,
cx: &mut ViewContext<Self>, cx: &mut ViewContext<Self>,
) { ) {
if let EditorEvent::Edited = event { match event {
self.pending_prompt = self.prompt_editor.read(cx).text(cx); EditorEvent::Edited => {
cx.notify(); self.pending_prompt = self.prompt_editor.read(cx).text(cx);
cx.notify();
}
EditorEvent::Blurred => {
if !self.confirmed {
cx.emit(InlineAssistEditorEvent::Canceled);
}
}
_ => {}
} }
} }