Remove test-only transaction_group_interval method from MultiBuffer

This commit is contained in:
Antonio Scandurra 2021-12-14 14:17:33 +01:00
parent 2d1ff8f606
commit 119d44caf7
2 changed files with 5 additions and 10 deletions

View file

@ -3841,7 +3841,9 @@ mod tests {
#[gpui::test]
fn test_undo_redo_with_selection_restoration(cx: &mut MutableAppContext) {
let mut now = Instant::now();
let buffer = MultiBuffer::build_simple("123456", cx);
let buffer = cx.add_model(|cx| language::Buffer::new(0, "123456", cx));
let group_interval = buffer.read(cx).transaction_group_interval();
let buffer = cx.add_model(|cx| MultiBuffer::singleton(buffer, cx));
let settings = EditorSettings::test(cx);
let (_, editor) = cx.add_window(Default::default(), |cx| {
build_editor(buffer.clone(), settings, cx)
@ -3862,7 +3864,7 @@ mod tests {
assert_eq!(editor.text(cx), "12cde6");
assert_eq!(editor.selected_ranges(cx), vec![5..5]);
now += buffer.read(cx).transaction_group_interval(cx) + Duration::from_millis(1);
now += group_interval + Duration::from_millis(1);
editor.select_ranges([2..2], None, cx);
// Simulate an edit in another editor

View file

@ -15,7 +15,7 @@ use std::{
iter::{self, FromIterator, Peekable},
ops::{Range, Sub},
sync::Arc,
time::{Duration, Instant, SystemTime},
time::{Instant, SystemTime},
};
use sum_tree::{Bias, Cursor, SumTree};
use text::{
@ -136,13 +136,6 @@ impl MultiBuffer {
self.replica_id
}
pub fn transaction_group_interval(&self, cx: &AppContext) -> Duration {
self.as_singleton()
.unwrap()
.read(cx)
.transaction_group_interval()
}
pub fn snapshot(&self, cx: &AppContext) -> MultiBufferSnapshot {
self.sync(cx);
self.snapshot.borrow().clone()