mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Merge transactions into the original assistant transaction
Co-Authored-By: Nathan Sobo <nathan@zed.dev> Co-Authored-By: Kyle Caverly <kyle@zed.dev>
This commit is contained in:
parent
a69461dba2
commit
301a12923f
@ -85,7 +85,7 @@ impl RefactoringAssistant {
|
||||
anyhow::Ok(())
|
||||
});
|
||||
|
||||
let mut last_transaction = None;
|
||||
let mut first_transaction = None;
|
||||
while let Some(hunks) = hunks_rx.next().await {
|
||||
editor.update(&mut cx, |editor, cx| {
|
||||
let mut highlights = Vec::new();
|
||||
@ -120,14 +120,15 @@ impl RefactoringAssistant {
|
||||
cx,
|
||||
);
|
||||
if let Some(transaction) = buffer.end_transaction(cx) {
|
||||
if let Some(last_transaction) = last_transaction {
|
||||
if let Some(first_transaction) = first_transaction {
|
||||
buffer.merge_transaction_into(
|
||||
last_transaction,
|
||||
transaction,
|
||||
first_transaction,
|
||||
cx,
|
||||
);
|
||||
} else {
|
||||
first_transaction = Some(transaction);
|
||||
}
|
||||
last_transaction = Some(transaction);
|
||||
buffer.finalize_last_transaction(cx);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user