editor: Add active match highlight for buffer and project search (#44098)

Closes #28617

<img width="400" alt="image"
src="https://github.com/user-attachments/assets/b1c2880c-5744-4bed-a687-5c5e7aa7fef5"
/>

Release Notes:

- Improved visibility of the currently active match when browsing
results in buffer or project search.

---------

Co-authored-by: DarkMatter-999 <darkmatter999official@gmail.com>
This commit is contained in:
Smit Barmase
2025-12-04 03:55:04 +05:30
committed by GitHub
co-authored by DarkMatter-999
parent 87976e91cf
commit 8ad3a150c8
23 changed files with 342 additions and 149 deletions
+2
View File
@@ -91,6 +91,7 @@ impl ThemeColors {
tab_inactive_background: neutral().light().step_2(),
tab_active_background: neutral().light().step_1(),
search_match_background: neutral().light().step_5(),
search_active_match_background: neutral().light().step_7(),
panel_background: neutral().light().step_2(),
panel_focused_border: blue().light().step_10(),
panel_indent_guide: neutral().light_alpha().step_5(),
@@ -228,6 +229,7 @@ impl ThemeColors {
tab_inactive_background: neutral().dark().step_2(),
tab_active_background: neutral().dark().step_1(),
search_match_background: neutral().dark().step_5(),
search_active_match_background: neutral().dark().step_3(),
panel_background: neutral().dark().step_2(),
panel_focused_border: blue().dark().step_8(),
panel_indent_guide: neutral().dark_alpha().step_4(),
+1
View File
@@ -152,6 +152,7 @@ pub(crate) fn zed_default_dark() -> Theme {
tab_inactive_background: bg,
tab_active_background: editor,
search_match_background: bg,
search_active_match_background: bg,
editor_background: editor,
editor_gutter_background: editor,
+11 -4
View File
@@ -287,6 +287,15 @@ pub fn theme_colors_refinement(
.panel_background
.as_ref()
.and_then(|color| try_parse_color(color).ok());
let search_match_background = this
.search_match_background
.as_ref()
.and_then(|color| try_parse_color(color).ok());
let search_active_match_background = this
.search_active_match_background
.as_ref()
.and_then(|color| try_parse_color(color).ok())
.or(search_match_background);
ThemeColorsRefinement {
border,
border_variant: this
@@ -442,10 +451,8 @@ pub fn theme_colors_refinement(
.tab_active_background
.as_ref()
.and_then(|color| try_parse_color(color).ok()),
search_match_background: this
.search_match_background
.as_ref()
.and_then(|color| try_parse_color(color).ok()),
search_match_background: search_match_background,
search_active_match_background: search_active_match_background,
panel_background,
panel_focused_border: this
.panel_focused_border
+3
View File
@@ -128,6 +128,7 @@ pub struct ThemeColors {
pub tab_inactive_background: Hsla,
pub tab_active_background: Hsla,
pub search_match_background: Hsla,
pub search_active_match_background: Hsla,
pub panel_background: Hsla,
pub panel_focused_border: Hsla,
pub panel_indent_guide: Hsla,
@@ -352,6 +353,7 @@ pub enum ThemeColorField {
TabInactiveBackground,
TabActiveBackground,
SearchMatchBackground,
SearchActiveMatchBackground,
PanelBackground,
PanelFocusedBorder,
PanelIndentGuide,
@@ -467,6 +469,7 @@ impl ThemeColors {
ThemeColorField::TabInactiveBackground => self.tab_inactive_background,
ThemeColorField::TabActiveBackground => self.tab_active_background,
ThemeColorField::SearchMatchBackground => self.search_match_background,
ThemeColorField::SearchActiveMatchBackground => self.search_active_match_background,
ThemeColorField::PanelBackground => self.panel_background,
ThemeColorField::PanelFocusedBorder => self.panel_focused_border,
ThemeColorField::PanelIndentGuide => self.panel_indent_guide,