Merge branch 'main' into settings-file
This commit is contained in:
commit
b33a049958
27 changed files with 1304 additions and 448 deletions
|
@ -149,7 +149,9 @@ impl Toolbar for SearchBar {
|
|||
self.dismissed = true;
|
||||
for (editor, _) in &self.editors_with_matches {
|
||||
if let Some(editor) = editor.upgrade(cx) {
|
||||
editor.update(cx, |editor, cx| editor.clear_highlighted_ranges::<Self>(cx));
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.clear_background_highlights::<Self>(cx)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -388,7 +390,9 @@ impl SearchBar {
|
|||
if Some(&editor) == self.active_editor.as_ref() {
|
||||
active_editor_matches = Some((editor.downgrade(), ranges));
|
||||
} else {
|
||||
editor.update(cx, |editor, cx| editor.clear_highlighted_ranges::<Self>(cx));
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.clear_background_highlights::<Self>(cx)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -401,7 +405,9 @@ impl SearchBar {
|
|||
if let Some(editor) = self.active_editor.as_ref() {
|
||||
if query.is_empty() {
|
||||
self.active_match_index.take();
|
||||
editor.update(cx, |editor, cx| editor.clear_highlighted_ranges::<Self>(cx));
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.clear_background_highlights::<Self>(cx)
|
||||
});
|
||||
} else {
|
||||
let buffer = editor.read(cx).buffer().read(cx).snapshot(cx);
|
||||
let query = if self.regex {
|
||||
|
@ -470,7 +476,7 @@ impl SearchBar {
|
|||
}
|
||||
|
||||
let theme = &cx.app_state::<Settings>().theme.search;
|
||||
editor.highlight_ranges::<Self>(
|
||||
editor.highlight_background::<Self>(
|
||||
ranges,
|
||||
theme.match_background,
|
||||
cx,
|
||||
|
@ -547,7 +553,7 @@ mod tests {
|
|||
editor.next_notification(&cx).await;
|
||||
editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
editor.all_highlighted_ranges(cx),
|
||||
editor.all_background_highlights(cx),
|
||||
&[
|
||||
(
|
||||
DisplayPoint::new(2, 17)..DisplayPoint::new(2, 19),
|
||||
|
@ -568,7 +574,7 @@ mod tests {
|
|||
editor.next_notification(&cx).await;
|
||||
editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
editor.all_highlighted_ranges(cx),
|
||||
editor.all_background_highlights(cx),
|
||||
&[(
|
||||
DisplayPoint::new(2, 43)..DisplayPoint::new(2, 45),
|
||||
Color::red(),
|
||||
|
@ -584,7 +590,7 @@ mod tests {
|
|||
editor.next_notification(&cx).await;
|
||||
editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
editor.all_highlighted_ranges(cx),
|
||||
editor.all_background_highlights(cx),
|
||||
&[
|
||||
(
|
||||
DisplayPoint::new(0, 24)..DisplayPoint::new(0, 26),
|
||||
|
@ -625,7 +631,7 @@ mod tests {
|
|||
editor.next_notification(&cx).await;
|
||||
editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
editor.all_highlighted_ranges(cx),
|
||||
editor.all_background_highlights(cx),
|
||||
&[
|
||||
(
|
||||
DisplayPoint::new(0, 41)..DisplayPoint::new(0, 43),
|
||||
|
|
|
@ -553,7 +553,7 @@ impl ProjectSearchView {
|
|||
editor.select_ranges(match_ranges.first().cloned(), Some(Autoscroll::Fit), cx);
|
||||
}
|
||||
let theme = &cx.app_state::<Settings>().theme.search;
|
||||
editor.highlight_ranges::<Self>(match_ranges, theme.match_background, cx);
|
||||
editor.highlight_background::<Self>(match_ranges, theme.match_background, cx);
|
||||
});
|
||||
if self.query_editor.is_focused(cx) {
|
||||
self.focus_results_editor(cx);
|
||||
|
@ -752,7 +752,7 @@ mod tests {
|
|||
assert_eq!(
|
||||
search_view
|
||||
.results_editor
|
||||
.update(cx, |editor, cx| editor.all_highlighted_ranges(cx)),
|
||||
.update(cx, |editor, cx| editor.all_background_highlights(cx)),
|
||||
&[
|
||||
(
|
||||
DisplayPoint::new(2, 32)..DisplayPoint::new(2, 35),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue