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:
@@ -1065,7 +1065,7 @@ impl LocalWorktree {
|
||||
&self,
|
||||
path: &Path,
|
||||
cx: &mut ModelContext<Worktree>,
|
||||
) -> Task<Result<(File, String, Option<String>)>> {
|
||||
) -> Task<Result<(File, String, Option<Rope>)>> {
|
||||
let path = Arc::from(path);
|
||||
let abs_path = self.absolutize(&path);
|
||||
let fs = self.fs.clone();
|
||||
@@ -1096,7 +1096,7 @@ impl LocalWorktree {
|
||||
if abs_path_metadata.is_dir || abs_path_metadata.is_symlink {
|
||||
None
|
||||
} else {
|
||||
git_repo.lock().load_index_text(&repo_path)
|
||||
git_repo.lock().load_index_text(&repo_path).map(Rope::from)
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user