Stop highlighting selection matches in the search inputs (#53307)

Follow-up of https://github.com/zed-industries/zed/pull/52553

Restores previous search inputs' behavior where no extra highlights were
applied.

Before:


https://github.com/user-attachments/assets/38b6e70c-d5d5-4e06-abec-97d20af44f39

After: 


https://github.com/user-attachments/assets/6e4b3931-adf0-4c2a-afc3-f3c839fc9add


Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2026-04-07 19:17:49 +03:00 committed by GitHub
parent 0de9b553b5
commit 4f3e4d2f46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View file

@ -1265,6 +1265,7 @@ pub struct Editor {
>,
use_autoclose: bool,
use_auto_surround: bool,
use_selection_highlight: bool,
auto_replace_emoji_shortcode: bool,
jsx_tag_auto_close_enabled_in_any_buffer: bool,
show_git_blame_gutter: bool,
@ -2468,6 +2469,7 @@ impl Editor {
read_only: is_minimap,
use_autoclose: true,
use_auto_surround: true,
use_selection_highlight: true,
auto_replace_emoji_shortcode: false,
jsx_tag_auto_close_enabled_in_any_buffer: false,
leader_id: None,
@ -3547,6 +3549,10 @@ impl Editor {
self.use_autoclose = autoclose;
}
pub fn set_use_selection_highlight(&mut self, highlight: bool) {
self.use_selection_highlight = highlight;
}
pub fn set_use_auto_surround(&mut self, auto_surround: bool) {
self.use_auto_surround = auto_surround;
}
@ -7699,7 +7705,7 @@ impl Editor {
if matches!(self.mode, EditorMode::SingleLine) {
return None;
}
if !EditorSettings::get_global(cx).selection_highlight {
if !self.use_selection_highlight || !EditorSettings::get_global(cx).selection_highlight {
return None;
}
if self.selections.count() != 1 || self.selections.line_mode() {

View file

@ -849,6 +849,7 @@ impl BufferSearchBar {
let query_editor = cx.new(|cx| {
let mut editor = Editor::auto_height(1, 4, window, cx);
editor.set_use_autoclose(false);
editor.set_use_selection_highlight(false);
editor
});
cx.subscribe_in(&query_editor, window, Self::on_query_editor_event)

View file

@ -939,6 +939,7 @@ impl ProjectSearchView {
let mut editor = Editor::auto_height(1, 4, window, cx);
editor.set_placeholder_text("Search all files…", window, cx);
editor.set_use_autoclose(false);
editor.set_use_selection_highlight(false);
editor.set_text(query_text, window, cx);
editor
});