New excerpt controls (#24428)
Release Notes: - Multibuffers now use less vertical space for excerpt boundaries. Additionally the expand up/down arrows are hidden at the start and end of the buffers --------- Co-authored-by: Nate Butler <iamnbutler@gmail.com> Co-authored-by: Zed AI <claude-3.5-sonnet@zed.dev>
This commit is contained in:
parent
3935e8343a
commit
e3c0f56a96
37 changed files with 513 additions and 707 deletions
|
@ -2678,7 +2678,7 @@ mod tests {
|
|||
],
|
||||
cx,
|
||||
);
|
||||
Editor::for_multibuffer(multibuffer, None, false, window, cx)
|
||||
Editor::for_multibuffer(multibuffer, None, window, cx)
|
||||
});
|
||||
|
||||
let search_bar = cx.new_window_entity(|window, cx| {
|
||||
|
|
|
@ -739,8 +739,7 @@ impl ProjectSearchView {
|
|||
editor
|
||||
});
|
||||
let results_editor = cx.new(|cx| {
|
||||
let mut editor =
|
||||
Editor::for_multibuffer(excerpts, Some(project.clone()), true, window, cx);
|
||||
let mut editor = Editor::for_multibuffer(excerpts, Some(project.clone()), window, cx);
|
||||
editor.set_searchable(false);
|
||||
editor.set_in_project_search(true);
|
||||
editor
|
||||
|
@ -2273,7 +2272,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.display_text(cx)),
|
||||
"\n\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\n\n\nconst TWO: usize = one::ONE + one::ONE;\n"
|
||||
"\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\nconst TWO: usize = one::ONE + one::ONE;"
|
||||
);
|
||||
let match_background_color = cx.theme().colors().search_match_background;
|
||||
assert_eq!(
|
||||
|
@ -2282,15 +2281,15 @@ pub mod tests {
|
|||
.update(cx, |editor, cx| editor.all_text_background_highlights(window, cx)),
|
||||
&[
|
||||
(
|
||||
DisplayPoint::new(DisplayRow(3), 32)..DisplayPoint::new(DisplayRow(3), 35),
|
||||
DisplayPoint::new(DisplayRow(2), 32)..DisplayPoint::new(DisplayRow(2), 35),
|
||||
match_background_color
|
||||
),
|
||||
(
|
||||
DisplayPoint::new(DisplayRow(3), 37)..DisplayPoint::new(DisplayRow(3), 40),
|
||||
DisplayPoint::new(DisplayRow(2), 37)..DisplayPoint::new(DisplayRow(2), 40),
|
||||
match_background_color
|
||||
),
|
||||
(
|
||||
DisplayPoint::new(DisplayRow(8), 6)..DisplayPoint::new(DisplayRow(8), 9),
|
||||
DisplayPoint::new(DisplayRow(5), 6)..DisplayPoint::new(DisplayRow(5), 9),
|
||||
match_background_color
|
||||
)
|
||||
]
|
||||
|
@ -2300,7 +2299,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 32)..DisplayPoint::new(DisplayRow(3), 35)]
|
||||
[DisplayPoint::new(DisplayRow(2), 32)..DisplayPoint::new(DisplayRow(2), 35)]
|
||||
);
|
||||
|
||||
search_view.select_match(Direction::Next, window, cx);
|
||||
|
@ -2313,7 +2312,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 37)..DisplayPoint::new(DisplayRow(3), 40)]
|
||||
[DisplayPoint::new(DisplayRow(2), 37)..DisplayPoint::new(DisplayRow(2), 40)]
|
||||
);
|
||||
search_view.select_match(Direction::Next, window, cx);
|
||||
})
|
||||
|
@ -2326,7 +2325,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(8), 6)..DisplayPoint::new(DisplayRow(8), 9)]
|
||||
[DisplayPoint::new(DisplayRow(5), 6)..DisplayPoint::new(DisplayRow(5), 9)]
|
||||
);
|
||||
search_view.select_match(Direction::Next, window, cx);
|
||||
})
|
||||
|
@ -2339,7 +2338,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 32)..DisplayPoint::new(DisplayRow(3), 35)]
|
||||
[DisplayPoint::new(DisplayRow(2), 32)..DisplayPoint::new(DisplayRow(2), 35)]
|
||||
);
|
||||
search_view.select_match(Direction::Prev, window, cx);
|
||||
})
|
||||
|
@ -2352,7 +2351,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(8), 6)..DisplayPoint::new(DisplayRow(8), 9)]
|
||||
[DisplayPoint::new(DisplayRow(5), 6)..DisplayPoint::new(DisplayRow(5), 9)]
|
||||
);
|
||||
search_view.select_match(Direction::Prev, window, cx);
|
||||
})
|
||||
|
@ -2365,7 +2364,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 37)..DisplayPoint::new(DisplayRow(3), 40)]
|
||||
[DisplayPoint::new(DisplayRow(2), 37)..DisplayPoint::new(DisplayRow(2), 40)]
|
||||
);
|
||||
})
|
||||
.unwrap();
|
||||
|
@ -2538,7 +2537,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.display_text(cx)),
|
||||
"\n\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\n\n\nconst TWO: usize = one::ONE + one::ONE;\n",
|
||||
"\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\nconst TWO: usize = one::ONE + one::ONE;",
|
||||
"Search view results should match the query"
|
||||
);
|
||||
assert!(
|
||||
|
@ -2582,7 +2581,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.display_text(cx)),
|
||||
"\n\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\n\n\nconst TWO: usize = one::ONE + one::ONE;\n",
|
||||
"\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\nconst TWO: usize = one::ONE + one::ONE;",
|
||||
"Results should be unchanged after search view 2nd open in a row"
|
||||
);
|
||||
assert!(
|
||||
|
@ -2774,7 +2773,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.display_text(cx)),
|
||||
"\n\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\n\n\nconst TWO: usize = one::ONE + one::ONE;\n",
|
||||
"\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\nconst TWO: usize = one::ONE + one::ONE;",
|
||||
"Search view results should match the query"
|
||||
);
|
||||
assert!(
|
||||
|
@ -2829,7 +2828,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.display_text(cx)),
|
||||
"\n\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\n\n\nconst TWO: usize = one::ONE + one::ONE;\n",
|
||||
"\n\nconst THREE: usize = one::ONE + two::TWO;\n\n\nconst TWO: usize = one::ONE + one::ONE;",
|
||||
"Results of the first search view should not update too"
|
||||
);
|
||||
assert!(
|
||||
|
@ -2878,7 +2877,7 @@ pub mod tests {
|
|||
search_view_2
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.display_text(cx)),
|
||||
"\n\n\nconst FOUR: usize = one::ONE + three::THREE;\n",
|
||||
"\n\nconst FOUR: usize = one::ONE + three::THREE;",
|
||||
"New search view with the updated query should have new search results"
|
||||
);
|
||||
assert!(
|
||||
|
@ -3023,7 +3022,7 @@ pub mod tests {
|
|||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.display_text(cx)),
|
||||
"\n\n\nconst ONE: usize = 1;\n\n\n\n\nconst TWO: usize = one::ONE + one::ONE;\n",
|
||||
"\n\nconst ONE: usize = 1;\n\n\nconst TWO: usize = one::ONE + one::ONE;",
|
||||
"New search in directory should have a filter that matches a certain directory"
|
||||
);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue