Use Rope instead of String for buffer diff base (#11300)
As an attempt to do things better when showing diff hunks, store diff base as Rope, not String, to have cheaper clones when the diff base text is reused, e.g. creating another buffer with the diff base text for hunk diff expanding. Release Notes: - N/A
This commit is contained in:
@@ -21,6 +21,7 @@ use std::{
|
||||
Arc,
|
||||
},
|
||||
};
|
||||
use text::Rope;
|
||||
use ui::Context;
|
||||
use util::{
|
||||
assert_set_eq,
|
||||
@@ -271,7 +272,7 @@ impl EditorTestContext {
|
||||
}
|
||||
|
||||
pub fn set_diff_base(&mut self, diff_base: Option<&str>) {
|
||||
let diff_base = diff_base.map(String::from);
|
||||
let diff_base = diff_base.map(Rope::from);
|
||||
self.update_buffer(|buffer, cx| buffer.set_diff_base(diff_base, cx));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user