Project Diff 2 (#23891)
This adds a new version of the project diff editor to go alongside the new git panel. The basics seem to be working, but still todo: * [ ] Fix untracked files * [ ] Fix deleted files * [ ] Show commit message editor at top * [x] Handle empty state * [x] Fix panic where locator sometimes seeks to wrong excerpt Release Notes: - N/A
This commit is contained in:
@@ -339,7 +339,6 @@ pub fn init(cx: &mut App) {
|
||||
.detach();
|
||||
}
|
||||
});
|
||||
git::project_diff::init(cx);
|
||||
}
|
||||
|
||||
pub struct SearchWithinRange;
|
||||
@@ -4653,7 +4652,7 @@ impl Editor {
|
||||
let mut read_ranges = Vec::new();
|
||||
for highlight in highlights {
|
||||
for (excerpt_id, excerpt_range) in
|
||||
buffer.excerpts_for_buffer(&cursor_buffer, cx)
|
||||
buffer.excerpts_for_buffer(cursor_buffer.read(cx).remote_id(), cx)
|
||||
{
|
||||
let start = highlight
|
||||
.range
|
||||
@@ -11747,10 +11746,7 @@ impl Editor {
|
||||
if self.buffer().read(cx).is_singleton() || self.is_buffer_folded(buffer_id, cx) {
|
||||
return;
|
||||
}
|
||||
let Some(buffer) = self.buffer().read(cx).buffer(buffer_id) else {
|
||||
return;
|
||||
};
|
||||
let folded_excerpts = self.buffer().read(cx).excerpts_for_buffer(&buffer, cx);
|
||||
let folded_excerpts = self.buffer().read(cx).excerpts_for_buffer(buffer_id, cx);
|
||||
self.display_map
|
||||
.update(cx, |display_map, cx| display_map.fold_buffer(buffer_id, cx));
|
||||
cx.emit(EditorEvent::BufferFoldToggled {
|
||||
@@ -11764,10 +11760,7 @@ impl Editor {
|
||||
if self.buffer().read(cx).is_singleton() || !self.is_buffer_folded(buffer_id, cx) {
|
||||
return;
|
||||
}
|
||||
let Some(buffer) = self.buffer().read(cx).buffer(buffer_id) else {
|
||||
return;
|
||||
};
|
||||
let unfolded_excerpts = self.buffer().read(cx).excerpts_for_buffer(&buffer, cx);
|
||||
let unfolded_excerpts = self.buffer().read(cx).excerpts_for_buffer(buffer_id, cx);
|
||||
self.display_map.update(cx, |display_map, cx| {
|
||||
display_map.unfold_buffer(buffer_id, cx);
|
||||
});
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
pub mod blame;
|
||||
pub mod project_diff;
|
||||
|
||||
@@ -743,12 +743,12 @@ fn determine_query_ranges(
|
||||
excerpt_visible_range: Range<usize>,
|
||||
cx: &mut Context<'_, MultiBuffer>,
|
||||
) -> Option<QueryRanges> {
|
||||
let buffer = excerpt_buffer.read(cx);
|
||||
let full_excerpt_range = multi_buffer
|
||||
.excerpts_for_buffer(excerpt_buffer, cx)
|
||||
.excerpts_for_buffer(buffer.remote_id(), cx)
|
||||
.into_iter()
|
||||
.find(|(id, _)| id == &excerpt_id)
|
||||
.map(|(_, range)| range.context)?;
|
||||
let buffer = excerpt_buffer.read(cx);
|
||||
let snapshot = buffer.snapshot();
|
||||
let excerpt_visible_len = excerpt_visible_range.end - excerpt_visible_range.start;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user