Remove ExcerptProperties struct
Pass buffer and range as separate parameters Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
b67be5ded3
commit
aa7dfbdd9c
4 changed files with 54 additions and 191 deletions
|
@ -7,7 +7,7 @@ use editor::{
|
||||||
display_map::{BlockDisposition, BlockId, BlockProperties, RenderBlock},
|
display_map::{BlockDisposition, BlockId, BlockProperties, RenderBlock},
|
||||||
highlight_diagnostic_message,
|
highlight_diagnostic_message,
|
||||||
items::BufferItemHandle,
|
items::BufferItemHandle,
|
||||||
Autoscroll, BuildSettings, Editor, ExcerptId, ExcerptProperties, MultiBuffer, ToOffset,
|
Autoscroll, BuildSettings, Editor, ExcerptId, MultiBuffer, ToOffset,
|
||||||
};
|
};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
action, elements::*, fonts::TextStyle, keymap::Binding, AnyViewHandle, AppContext, Entity,
|
action, elements::*, fonts::TextStyle, keymap::Binding, AnyViewHandle, AppContext, Entity,
|
||||||
|
@ -335,10 +335,8 @@ impl ProjectDiagnosticsEditor {
|
||||||
);
|
);
|
||||||
let excerpt_id = excerpts.insert_excerpt_after(
|
let excerpt_id = excerpts.insert_excerpt_after(
|
||||||
&prev_excerpt_id,
|
&prev_excerpt_id,
|
||||||
ExcerptProperties {
|
buffer.clone(),
|
||||||
buffer: &buffer,
|
excerpt_start..excerpt_end,
|
||||||
range: excerpt_start..excerpt_end,
|
|
||||||
},
|
|
||||||
excerpts_cx,
|
excerpts_cx,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ use language::{
|
||||||
};
|
};
|
||||||
use multi_buffer::MultiBufferChunks;
|
use multi_buffer::MultiBufferChunks;
|
||||||
pub use multi_buffer::{
|
pub use multi_buffer::{
|
||||||
char_kind, Anchor, AnchorRangeExt, CharKind, ExcerptId, ExcerptProperties, MultiBuffer,
|
char_kind, Anchor, AnchorRangeExt, CharKind, ExcerptId, MultiBuffer, MultiBufferSnapshot,
|
||||||
MultiBufferSnapshot, ToOffset, ToPoint,
|
ToOffset, ToPoint,
|
||||||
};
|
};
|
||||||
use ordered_float::OrderedFloat;
|
use ordered_float::OrderedFloat;
|
||||||
use postage::watch;
|
use postage::watch;
|
||||||
|
@ -7870,20 +7870,8 @@ mod tests {
|
||||||
let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx));
|
let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx));
|
||||||
let multibuffer = cx.add_model(|cx| {
|
let multibuffer = cx.add_model(|cx| {
|
||||||
let mut multibuffer = MultiBuffer::new(0);
|
let mut multibuffer = MultiBuffer::new(0);
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer.clone(), Point::new(0, 0)..Point::new(0, 4), cx);
|
||||||
ExcerptProperties {
|
multibuffer.push_excerpt(buffer.clone(), Point::new(1, 0)..Point::new(1, 4), cx);
|
||||||
buffer: &buffer,
|
|
||||||
range: Point::new(0, 0)..Point::new(0, 4),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer,
|
|
||||||
range: Point::new(1, 0)..Point::new(1, 4),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer
|
multibuffer
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7921,20 +7909,8 @@ mod tests {
|
||||||
let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx));
|
let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx));
|
||||||
let multibuffer = cx.add_model(|cx| {
|
let multibuffer = cx.add_model(|cx| {
|
||||||
let mut multibuffer = MultiBuffer::new(0);
|
let mut multibuffer = MultiBuffer::new(0);
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer, Point::new(0, 0)..Point::new(1, 4), cx);
|
||||||
ExcerptProperties {
|
multibuffer.push_excerpt(buffer, Point::new(1, 0)..Point::new(2, 4), cx);
|
||||||
buffer: &buffer,
|
|
||||||
range: Point::new(0, 0)..Point::new(1, 4),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer,
|
|
||||||
range: Point::new(1, 0)..Point::new(2, 4),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer
|
multibuffer
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7986,19 +7962,11 @@ mod tests {
|
||||||
let multibuffer = cx.add_model(|cx| {
|
let multibuffer = cx.add_model(|cx| {
|
||||||
let mut multibuffer = MultiBuffer::new(0);
|
let mut multibuffer = MultiBuffer::new(0);
|
||||||
excerpt1_id = Some(multibuffer.push_excerpt(
|
excerpt1_id = Some(multibuffer.push_excerpt(
|
||||||
ExcerptProperties {
|
buffer.clone(),
|
||||||
buffer: &buffer,
|
Point::new(0, 0)..Point::new(1, 4),
|
||||||
range: Point::new(0, 0)..Point::new(1, 4),
|
|
||||||
},
|
|
||||||
cx,
|
cx,
|
||||||
));
|
));
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer.clone(), Point::new(1, 0)..Point::new(2, 4), cx);
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer,
|
|
||||||
range: Point::new(1, 0)..Point::new(2, 4),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer
|
multibuffer
|
||||||
});
|
});
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -225,7 +225,7 @@ pub fn surrounding_word(map: &DisplaySnapshot, position: DisplayPoint) -> Range<
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{Buffer, DisplayMap, ExcerptProperties, MultiBuffer};
|
use crate::{Buffer, DisplayMap, MultiBuffer};
|
||||||
use language::Point;
|
use language::Point;
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
|
@ -239,20 +239,8 @@ mod tests {
|
||||||
let buffer = cx.add_model(|cx| Buffer::new(0, "abc\ndefg\nhijkl\nmn", cx));
|
let buffer = cx.add_model(|cx| Buffer::new(0, "abc\ndefg\nhijkl\nmn", cx));
|
||||||
let multibuffer = cx.add_model(|cx| {
|
let multibuffer = cx.add_model(|cx| {
|
||||||
let mut multibuffer = MultiBuffer::new(0);
|
let mut multibuffer = MultiBuffer::new(0);
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer.clone(), Point::new(0, 0)..Point::new(1, 4), cx);
|
||||||
ExcerptProperties {
|
multibuffer.push_excerpt(buffer.clone(), Point::new(2, 0)..Point::new(3, 2), cx);
|
||||||
buffer: &buffer,
|
|
||||||
range: Point::new(0, 0)..Point::new(1, 4),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer,
|
|
||||||
range: Point::new(2, 0)..Point::new(3, 2),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer
|
multibuffer
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -98,11 +98,6 @@ pub struct MultiBufferSnapshot {
|
||||||
has_conflict: bool,
|
has_conflict: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExcerptProperties<'a, T> {
|
|
||||||
pub buffer: &'a ModelHandle<Buffer>,
|
|
||||||
pub range: Range<T>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ExcerptBoundary {
|
pub struct ExcerptBoundary {
|
||||||
pub row: u32,
|
pub row: u32,
|
||||||
pub buffer: BufferSnapshot,
|
pub buffer: BufferSnapshot,
|
||||||
|
@ -178,13 +173,7 @@ impl MultiBuffer {
|
||||||
pub fn singleton(buffer: ModelHandle<Buffer>, cx: &mut ModelContext<Self>) -> Self {
|
pub fn singleton(buffer: ModelHandle<Buffer>, cx: &mut ModelContext<Self>) -> Self {
|
||||||
let mut this = Self::new(buffer.read(cx).replica_id());
|
let mut this = Self::new(buffer.read(cx).replica_id());
|
||||||
this.singleton = true;
|
this.singleton = true;
|
||||||
this.push_excerpt(
|
this.push_excerpt(buffer, text::Anchor::min()..text::Anchor::max(), cx);
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer,
|
|
||||||
range: text::Anchor::min()..text::Anchor::max(),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
this.snapshot.borrow_mut().singleton = true;
|
this.snapshot.borrow_mut().singleton = true;
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
@ -587,19 +576,21 @@ impl MultiBuffer {
|
||||||
|
|
||||||
pub fn push_excerpt<O>(
|
pub fn push_excerpt<O>(
|
||||||
&mut self,
|
&mut self,
|
||||||
props: ExcerptProperties<O>,
|
buffer: ModelHandle<Buffer>,
|
||||||
|
range: Range<O>,
|
||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
||||||
) -> ExcerptId
|
) -> ExcerptId
|
||||||
where
|
where
|
||||||
O: text::ToOffset,
|
O: text::ToOffset,
|
||||||
{
|
{
|
||||||
self.insert_excerpt_after(&ExcerptId::max(), props, cx)
|
self.insert_excerpt_after(&ExcerptId::max(), buffer, range, cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_excerpt_after<O>(
|
pub fn insert_excerpt_after<O>(
|
||||||
&mut self,
|
&mut self,
|
||||||
prev_excerpt_id: &ExcerptId,
|
prev_excerpt_id: &ExcerptId,
|
||||||
props: ExcerptProperties<O>,
|
buffer: ModelHandle<Buffer>,
|
||||||
|
range: Range<O>,
|
||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
||||||
) -> ExcerptId
|
) -> ExcerptId
|
||||||
where
|
where
|
||||||
|
@ -608,9 +599,10 @@ impl MultiBuffer {
|
||||||
assert_eq!(self.history.transaction_depth, 0);
|
assert_eq!(self.history.transaction_depth, 0);
|
||||||
self.sync(cx);
|
self.sync(cx);
|
||||||
|
|
||||||
let buffer_snapshot = props.buffer.read(cx).snapshot();
|
let buffer_id = buffer.id();
|
||||||
let range = buffer_snapshot.anchor_before(&props.range.start)
|
let buffer_snapshot = buffer.read(cx).snapshot();
|
||||||
..buffer_snapshot.anchor_after(&props.range.end);
|
let range =
|
||||||
|
buffer_snapshot.anchor_before(&range.start)..buffer_snapshot.anchor_after(&range.end);
|
||||||
let mut snapshot = self.snapshot.borrow_mut();
|
let mut snapshot = self.snapshot.borrow_mut();
|
||||||
let mut cursor = snapshot.excerpts.cursor::<Option<&ExcerptId>>();
|
let mut cursor = snapshot.excerpts.cursor::<Option<&ExcerptId>>();
|
||||||
let mut new_excerpts = cursor.slice(&Some(prev_excerpt_id), Bias::Right, &());
|
let mut new_excerpts = cursor.slice(&Some(prev_excerpt_id), Bias::Right, &());
|
||||||
|
@ -633,28 +625,26 @@ impl MultiBuffer {
|
||||||
let id = ExcerptId::between(&prev_id, &next_id);
|
let id = ExcerptId::between(&prev_id, &next_id);
|
||||||
|
|
||||||
let mut buffers = self.buffers.borrow_mut();
|
let mut buffers = self.buffers.borrow_mut();
|
||||||
let buffer_state = buffers
|
let buffer_state = buffers.entry(buffer_id).or_insert_with(|| BufferState {
|
||||||
.entry(props.buffer.id())
|
last_version: buffer_snapshot.version().clone(),
|
||||||
.or_insert_with(|| BufferState {
|
last_parse_count: buffer_snapshot.parse_count(),
|
||||||
last_version: buffer_snapshot.version().clone(),
|
last_selections_update_count: buffer_snapshot.selections_update_count(),
|
||||||
last_parse_count: buffer_snapshot.parse_count(),
|
last_diagnostics_update_count: buffer_snapshot.diagnostics_update_count(),
|
||||||
last_selections_update_count: buffer_snapshot.selections_update_count(),
|
last_file_update_count: buffer_snapshot.file_update_count(),
|
||||||
last_diagnostics_update_count: buffer_snapshot.diagnostics_update_count(),
|
excerpts: Default::default(),
|
||||||
last_file_update_count: buffer_snapshot.file_update_count(),
|
_subscriptions: [
|
||||||
excerpts: Default::default(),
|
cx.observe(&buffer, |_, _, cx| cx.notify()),
|
||||||
_subscriptions: [
|
cx.subscribe(&buffer, Self::on_buffer_event),
|
||||||
cx.observe(&props.buffer, |_, _, cx| cx.notify()),
|
],
|
||||||
cx.subscribe(&props.buffer, Self::on_buffer_event),
|
buffer,
|
||||||
],
|
});
|
||||||
buffer: props.buffer.clone(),
|
|
||||||
});
|
|
||||||
if let Err(ix) = buffer_state.excerpts.binary_search(&id) {
|
if let Err(ix) = buffer_state.excerpts.binary_search(&id) {
|
||||||
buffer_state.excerpts.insert(ix, id.clone());
|
buffer_state.excerpts.insert(ix, id.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
let excerpt = Excerpt::new(
|
let excerpt = Excerpt::new(
|
||||||
id.clone(),
|
id.clone(),
|
||||||
props.buffer.id(),
|
buffer_id,
|
||||||
buffer_snapshot,
|
buffer_snapshot,
|
||||||
range,
|
range,
|
||||||
cursor.item().is_some(),
|
cursor.item().is_some(),
|
||||||
|
@ -1082,13 +1072,7 @@ impl MultiBuffer {
|
||||||
&buffer.text()[start_ix..end_ix]
|
&buffer.text()[start_ix..end_ix]
|
||||||
);
|
);
|
||||||
|
|
||||||
let excerpt_id = self.push_excerpt(
|
let excerpt_id = self.push_excerpt(buffer_handle.clone(), start_ix..end_ix, cx);
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_handle,
|
|
||||||
range: start_ix..end_ix,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
log::info!("Inserted with id: {:?}", excerpt_id);
|
log::info!("Inserted with id: {:?}", excerpt_id);
|
||||||
} else {
|
} else {
|
||||||
let remove_count = rng.gen_range(1..=excerpt_ids.len());
|
let remove_count = rng.gen_range(1..=excerpt_ids.len());
|
||||||
|
@ -2683,13 +2667,7 @@ mod tests {
|
||||||
|
|
||||||
let subscription = multibuffer.update(cx, |multibuffer, cx| {
|
let subscription = multibuffer.update(cx, |multibuffer, cx| {
|
||||||
let subscription = multibuffer.subscribe();
|
let subscription = multibuffer.subscribe();
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer_1.clone(), Point::new(1, 2)..Point::new(2, 5), cx);
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_1,
|
|
||||||
range: Point::new(1, 2)..Point::new(2, 5),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
subscription.consume().into_inner(),
|
subscription.consume().into_inner(),
|
||||||
[Edit {
|
[Edit {
|
||||||
|
@ -2698,20 +2676,8 @@ mod tests {
|
||||||
}]
|
}]
|
||||||
);
|
);
|
||||||
|
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer_1.clone(), Point::new(3, 3)..Point::new(4, 4), cx);
|
||||||
ExcerptProperties {
|
multibuffer.push_excerpt(buffer_2.clone(), Point::new(3, 1)..Point::new(3, 3), cx);
|
||||||
buffer: &buffer_1,
|
|
||||||
range: Point::new(3, 3)..Point::new(4, 4),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_2,
|
|
||||||
range: Point::new(3, 1)..Point::new(3, 3),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
subscription.consume().into_inner(),
|
subscription.consume().into_inner(),
|
||||||
[Edit {
|
[Edit {
|
||||||
|
@ -2913,20 +2879,8 @@ mod tests {
|
||||||
let buffer_2 = cx.add_model(|cx| Buffer::new(0, "efghi", cx));
|
let buffer_2 = cx.add_model(|cx| Buffer::new(0, "efghi", cx));
|
||||||
let multibuffer = cx.add_model(|cx| {
|
let multibuffer = cx.add_model(|cx| {
|
||||||
let mut multibuffer = MultiBuffer::new(0);
|
let mut multibuffer = MultiBuffer::new(0);
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer_1.clone(), 0..4, cx);
|
||||||
ExcerptProperties {
|
multibuffer.push_excerpt(buffer_2.clone(), 0..5, cx);
|
||||||
buffer: &buffer_1,
|
|
||||||
range: 0..4,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_2,
|
|
||||||
range: 0..5,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer
|
multibuffer
|
||||||
});
|
});
|
||||||
let old_snapshot = multibuffer.read(cx).snapshot(cx);
|
let old_snapshot = multibuffer.read(cx).snapshot(cx);
|
||||||
|
@ -2975,13 +2929,7 @@ mod tests {
|
||||||
// Add an excerpt from buffer 1 that spans this new insertion.
|
// Add an excerpt from buffer 1 that spans this new insertion.
|
||||||
buffer_1.update(cx, |buffer, cx| buffer.edit([4..4], "123", cx));
|
buffer_1.update(cx, |buffer, cx| buffer.edit([4..4], "123", cx));
|
||||||
let excerpt_id_1 = multibuffer.update(cx, |multibuffer, cx| {
|
let excerpt_id_1 = multibuffer.update(cx, |multibuffer, cx| {
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer_1.clone(), 0..7, cx)
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_1,
|
|
||||||
range: 0..7,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let snapshot_1 = multibuffer.read(cx).snapshot(cx);
|
let snapshot_1 = multibuffer.read(cx).snapshot(cx);
|
||||||
|
@ -2991,27 +2939,9 @@ mod tests {
|
||||||
let (excerpt_id_2, excerpt_id_3, _) = multibuffer.update(cx, |multibuffer, cx| {
|
let (excerpt_id_2, excerpt_id_3, _) = multibuffer.update(cx, |multibuffer, cx| {
|
||||||
multibuffer.remove_excerpts([&excerpt_id_1], cx);
|
multibuffer.remove_excerpts([&excerpt_id_1], cx);
|
||||||
(
|
(
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer_2.clone(), 0..4, cx),
|
||||||
ExcerptProperties {
|
multibuffer.push_excerpt(buffer_2.clone(), 6..10, cx),
|
||||||
buffer: &buffer_2,
|
multibuffer.push_excerpt(buffer_2.clone(), 12..16, cx),
|
||||||
range: 0..4,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
),
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_2,
|
|
||||||
range: 6..10,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
),
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_2,
|
|
||||||
range: 12..16,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let snapshot_2 = multibuffer.read(cx).snapshot(cx);
|
let snapshot_2 = multibuffer.read(cx).snapshot(cx);
|
||||||
|
@ -3049,14 +2979,7 @@ mod tests {
|
||||||
// that intersects the old excerpt.
|
// that intersects the old excerpt.
|
||||||
let excerpt_id_5 = multibuffer.update(cx, |multibuffer, cx| {
|
let excerpt_id_5 = multibuffer.update(cx, |multibuffer, cx| {
|
||||||
multibuffer.remove_excerpts([&excerpt_id_3], cx);
|
multibuffer.remove_excerpts([&excerpt_id_3], cx);
|
||||||
multibuffer.insert_excerpt_after(
|
multibuffer.insert_excerpt_after(&excerpt_id_3, buffer_2.clone(), 5..8, cx)
|
||||||
&excerpt_id_3,
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_2,
|
|
||||||
range: 5..8,
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let snapshot_3 = multibuffer.read(cx).snapshot(cx);
|
let snapshot_3 = multibuffer.read(cx).snapshot(cx);
|
||||||
|
@ -3198,10 +3121,8 @@ mod tests {
|
||||||
let excerpt_id = multibuffer.update(cx, |multibuffer, cx| {
|
let excerpt_id = multibuffer.update(cx, |multibuffer, cx| {
|
||||||
multibuffer.insert_excerpt_after(
|
multibuffer.insert_excerpt_after(
|
||||||
&prev_excerpt_id,
|
&prev_excerpt_id,
|
||||||
ExcerptProperties {
|
buffer_handle.clone(),
|
||||||
buffer: &buffer_handle,
|
start_ix..end_ix,
|
||||||
range: start_ix..end_ix,
|
|
||||||
},
|
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
@ -3507,20 +3428,8 @@ mod tests {
|
||||||
let multibuffer = cx.add_model(|_| MultiBuffer::new(0));
|
let multibuffer = cx.add_model(|_| MultiBuffer::new(0));
|
||||||
let group_interval = multibuffer.read(cx).history.group_interval;
|
let group_interval = multibuffer.read(cx).history.group_interval;
|
||||||
multibuffer.update(cx, |multibuffer, cx| {
|
multibuffer.update(cx, |multibuffer, cx| {
|
||||||
multibuffer.push_excerpt(
|
multibuffer.push_excerpt(buffer_1.clone(), 0..buffer_1.read(cx).len(), cx);
|
||||||
ExcerptProperties {
|
multibuffer.push_excerpt(buffer_2.clone(), 0..buffer_2.read(cx).len(), cx);
|
||||||
buffer: &buffer_1,
|
|
||||||
range: 0..buffer_1.read(cx).len(),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
multibuffer.push_excerpt(
|
|
||||||
ExcerptProperties {
|
|
||||||
buffer: &buffer_2,
|
|
||||||
range: 0..buffer_2.read(cx).len(),
|
|
||||||
},
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut now = Instant::now();
|
let mut now = Instant::now();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue