mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Allow user to restart transformation after stopping without a diff (#15858)
Release Notes: - N/A Co-authored-by: Jason <jason@zed.dev>
This commit is contained in:
parent
411934bb61
commit
9c6ccaffe3
@ -2036,6 +2036,12 @@ struct Diff {
|
||||
inserted_row_ranges: Vec<RangeInclusive<Anchor>>,
|
||||
}
|
||||
|
||||
impl Diff {
|
||||
fn is_empty(&self) -> bool {
|
||||
self.deleted_row_ranges.is_empty() && self.inserted_row_ranges.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
impl EventEmitter<CodegenEvent> for Codegen {}
|
||||
|
||||
impl Codegen {
|
||||
@ -2467,7 +2473,11 @@ impl Codegen {
|
||||
|
||||
pub fn stop(&mut self, cx: &mut ModelContext<Self>) {
|
||||
self.last_equal_ranges.clear();
|
||||
self.status = CodegenStatus::Done;
|
||||
if self.diff.is_empty() {
|
||||
self.status = CodegenStatus::Idle;
|
||||
} else {
|
||||
self.status = CodegenStatus::Done;
|
||||
}
|
||||
self.generation = Task::ready(());
|
||||
cx.emit(CodegenEvent::Finished);
|
||||
cx.notify();
|
||||
|
Loading…
Reference in New Issue
Block a user