git_ui: Fix open diff for untracked files when sorting by path enabled (#39862)
Fixes the `Open Diff` action for untracked files when the `sort_by_path` setting is enabled. The `ProjectDiff` wasn't correctly moving the multibuffer's cursor to the untracked file because, when that setting is enabled, it's sort prefix is changed to the tracked files sort prefix, and that wasn't accounted for in `move_to_entry`. Before these changes, the `sort_prefix` field for `PathKey` was called `namespace`, it was renamed to be clearer what its purpose is. Closes #39529 Release Notes: - Fixed 'Open Diff' action for untracked files when `sort_by_path` is enabled --------- Co-authored-by: David Kleingeld <davidsk@zed.dev>
This commit is contained in:
@@ -16518,7 +16518,7 @@ async fn test_following_with_multiple_excerpts(cx: &mut TestAppContext) {
|
||||
leader.update(cx, |leader, cx| {
|
||||
leader.buffer.update(cx, |multibuffer, cx| {
|
||||
multibuffer.set_excerpts_for_path(
|
||||
PathKey::namespaced(1, rel_path("b.txt").into_arc()),
|
||||
PathKey::with_sort_prefix(1, rel_path("b.txt").into_arc()),
|
||||
buffer_1.clone(),
|
||||
vec![
|
||||
Point::row_range(0..3),
|
||||
@@ -16529,7 +16529,7 @@ async fn test_following_with_multiple_excerpts(cx: &mut TestAppContext) {
|
||||
cx,
|
||||
);
|
||||
multibuffer.set_excerpts_for_path(
|
||||
PathKey::namespaced(1, rel_path("a.txt").into_arc()),
|
||||
PathKey::with_sort_prefix(1, rel_path("a.txt").into_arc()),
|
||||
buffer_2.clone(),
|
||||
vec![Point::row_range(0..6), Point::row_range(8..12)],
|
||||
0,
|
||||
@@ -21032,7 +21032,7 @@ async fn test_display_diff_hunks(cx: &mut TestAppContext) {
|
||||
for buffer in &buffers {
|
||||
let snapshot = buffer.read(cx).snapshot();
|
||||
multibuffer.set_excerpts_for_path(
|
||||
PathKey::namespaced(0, buffer.read(cx).file().unwrap().path().clone()),
|
||||
PathKey::with_sort_prefix(0, buffer.read(cx).file().unwrap().path().clone()),
|
||||
buffer.clone(),
|
||||
vec![text::Anchor::MIN.to_point(&snapshot)..text::Anchor::MAX.to_point(&snapshot)],
|
||||
2,
|
||||
|
||||
Reference in New Issue
Block a user