Rework inline assistant
This commit is contained in:
@@ -626,7 +626,7 @@ impl MultiBuffer {
|
||||
buffer.merge_transactions(transaction, destination)
|
||||
});
|
||||
} else {
|
||||
if let Some(transaction) = self.history.remove_transaction(transaction) {
|
||||
if let Some(transaction) = self.history.forget(transaction) {
|
||||
if let Some(destination) = self.history.transaction_mut(destination) {
|
||||
for (buffer_id, buffer_transaction_id) in transaction.buffer_transactions {
|
||||
if let Some(destination_buffer_transaction_id) =
|
||||
@@ -822,6 +822,18 @@ impl MultiBuffer {
|
||||
None
|
||||
}
|
||||
|
||||
pub fn undo_and_forget(&mut self, transaction_id: TransactionId, cx: &mut ModelContext<Self>) {
|
||||
if let Some(buffer) = self.as_singleton() {
|
||||
buffer.update(cx, |buffer, cx| buffer.undo_and_forget(transaction_id, cx));
|
||||
} else if let Some(transaction) = self.history.forget(transaction_id) {
|
||||
for (buffer_id, transaction_id) in transaction.buffer_transactions {
|
||||
if let Some(BufferState { buffer, .. }) = self.buffers.borrow().get(&buffer_id) {
|
||||
buffer.update(cx, |buffer, cx| buffer.undo_and_forget(transaction_id, cx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stream_excerpts_with_context_lines(
|
||||
&mut self,
|
||||
excerpts: Vec<(ModelHandle<Buffer>, Vec<Range<text::Anchor>>)>,
|
||||
@@ -3369,7 +3381,7 @@ impl History {
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_transaction(&mut self, transaction_id: TransactionId) -> Option<Transaction> {
|
||||
fn forget(&mut self, transaction_id: TransactionId) -> Option<Transaction> {
|
||||
if let Some(ix) = self
|
||||
.undo_stack
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user